Staging
v0.5.2
https://github.com/git/git
Revision 83ee94c12ca16ef020f3d71eda34b6559ed6dc67 authored by Junio C Hamano on 08 November 2006, 06:37:17 UTC, committed by Junio C Hamano on 08 November 2006, 06:42:05 UTC
A forked project is defined to be $projname/$forkname.git for
$projname.git; the code did not check this correctly and mistook
$projname/.git to be a fork of itself.  This minimally fixes the
breakage.

Also forks were not checked when index.aux file was in use.
Listing the forked ones in index.aux would show them also on the
toplevel index which may go against the hierarchical nature of
forks, but again this is a minimal fix to whip it in a better
shape suitable to be in the 'master' branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 5dd5ed0
Raw File
Tip revision: 83ee94c12ca16ef020f3d71eda34b6559ed6dc67 authored by Junio C Hamano on 08 November 2006, 06:37:17 UTC
gitweb: minimally fix "fork" support.
Tip revision: 83ee94c
unpack-file.c
#include "cache.h"
#include "blob.h"

static char *create_temp_file(unsigned char *sha1)
{
	static char path[50];
	void *buf;
	char type[100];
	unsigned long size;
	int fd;

	buf = read_sha1_file(sha1, type, &size);
	if (!buf || strcmp(type, blob_type))
		die("unable to read blob object %s", sha1_to_hex(sha1));

	strcpy(path, ".merge_file_XXXXXX");
	fd = mkstemp(path);
	if (fd < 0)
		die("unable to create temp-file");
	if (write(fd, buf, size) != size)
		die("unable to write temp-file");
	close(fd);
	return path;
}

int main(int argc, char **argv)
{
	unsigned char sha1[20];

	if (argc != 2)
		usage("git-unpack-file <sha1>");
	if (get_sha1(argv[1], sha1))
		die("Not a valid object name %s", argv[1]);

	setup_git_directory();
	git_config(git_default_config);

	puts(create_temp_file(sha1));
	return 0;
}
back to top