summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-28 09:47:43 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-28 10:24:32 -0700
commit6eec46bdda7393f1801df70a44d2e0577760a691 (patch)
tree49a2c61fc397b3ba65bd5e772754052f1a8b0013 /sha1_file.c
parentd683a0e00cd4734b4fab704baef1ee76205722be (diff)
downloadgit-6eec46bdda7393f1801df70a44d2e0577760a691.tar.gz
fix sha1_pack_index_name()
An earlier commit 633f43e (Remove redundant code, eliminate one static variable, 2008-05-24) had a thinko (perhaps an eyeno) that broke sha1_pack_index_name() function. One symptom of this was that the http walker is now completely broken. This should fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 9679040d62..adcf37c3f6 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -177,7 +177,7 @@ char *sha1_file_name(const unsigned char *sha1)
}
static char *sha1_get_pack_name(const unsigned char *sha1,
- char **name, char **base)
+ char **name, char **base, const char *which)
{
static const char hex[] = "0123456789abcdef";
char *buf;
@@ -187,7 +187,8 @@ static char *sha1_get_pack_name(const unsigned char *sha1,
const char *sha1_file_directory = get_object_directory();
int len = strlen(sha1_file_directory);
*base = xmalloc(len + 60);
- sprintf(*base, "%s/pack/pack-1234567890123456789012345678901234567890.pack", sha1_file_directory);
+ sprintf(*base, "%s/pack/pack-1234567890123456789012345678901234567890.%s",
+ sha1_file_directory, which);
*name = *base + len + 11;
}
@@ -206,14 +207,14 @@ char *sha1_pack_name(const unsigned char *sha1)
{
static char *name, *base;
- return sha1_get_pack_name(sha1, &name, &base);
+ return sha1_get_pack_name(sha1, &name, &base, "pack");
}
char *sha1_pack_index_name(const unsigned char *sha1)
{
static char *name, *base;
- return sha1_get_pack_name(sha1, &name, &base);
+ return sha1_get_pack_name(sha1, &name, &base, "idx");
}
struct alternate_object_database *alt_odb_list;