X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=sha1_file.c;h=895c1fab6fc00b8131e44851f33b79b1d2310b12;hb=750a09a7de63c92868cff41a3151eac320c77fa0;hp=66382027816e8ec3a97c40f6849c62454f2ad0f2;hpb=4803c2802c11525b11d106247661ea13b2a9ce98;p=git.git diff --git a/sha1_file.c b/sha1_file.c index 66382027..895c1fab 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -20,6 +20,8 @@ #endif #endif +const unsigned char null_sha1[20] = { 0, }; + static unsigned int sha1_file_open_flag = O_NOATIME; static unsigned hexval(char c) @@ -70,6 +72,13 @@ static void setup_git_env(void) git_graft_file = strdup(git_path("info/grafts")); } +char *get_git_dir(void) +{ + if (!git_dir) + setup_git_env(); + return git_dir; +} + char *get_object_directory(void) { if (!git_object_dir) @@ -864,7 +873,8 @@ void packed_object_info_detail(struct pack_entry *e, strcpy(type, "tag"); break; default: - die("corrupted pack file"); + die("corrupted pack file %s containing object of kind %d", + p->pack_name, kind); } *store_size = 0; /* notyet */ } @@ -903,7 +913,8 @@ static int packed_object_info(struct pack_entry *entry, strcpy(type, "tag"); break; default: - die("corrupted pack file"); + die("corrupted pack file %s containing object of kind %d", + p->pack_name, kind); } if (sizep) *sizep = size; @@ -1003,7 +1014,7 @@ static void *unpack_entry(struct pack_entry *entry, retval = unpack_entry_gently(entry, type, sizep); unuse_packed_git(p); if (!retval) - die("corrupted pack file"); + die("corrupted pack file %s", p->pack_name); return retval; }