Skip to content

Commit 6eec46b

Browse files
committed
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>
1 parent d683a0e commit 6eec46b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sha1_file.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ char *sha1_file_name(const unsigned char *sha1)
177177
}
178178

179179
static char *sha1_get_pack_name(const unsigned char *sha1,
180-
char **name, char **base)
180+
char **name, char **base, const char *which)
181181
{
182182
static const char hex[] = "0123456789abcdef";
183183
char *buf;
@@ -187,7 +187,8 @@ static char *sha1_get_pack_name(const unsigned char *sha1,
187187
const char *sha1_file_directory = get_object_directory();
188188
int len = strlen(sha1_file_directory);
189189
*base = xmalloc(len + 60);
190-
sprintf(*base, "%s/pack/pack-1234567890123456789012345678901234567890.pack", sha1_file_directory);
190+
sprintf(*base, "%s/pack/pack-1234567890123456789012345678901234567890.%s",
191+
sha1_file_directory, which);
191192
*name = *base + len + 11;
192193
}
193194

@@ -206,14 +207,14 @@ char *sha1_pack_name(const unsigned char *sha1)
206207
{
207208
static char *name, *base;
208209

209-
return sha1_get_pack_name(sha1, &name, &base);
210+
return sha1_get_pack_name(sha1, &name, &base, "pack");
210211
}
211212

212213
char *sha1_pack_index_name(const unsigned char *sha1)
213214
{
214215
static char *name, *base;
215216

216-
return sha1_get_pack_name(sha1, &name, &base);
217+
return sha1_get_pack_name(sha1, &name, &base, "idx");
217218
}
218219

219220
struct alternate_object_database *alt_odb_list;

0 commit comments

Comments
 (0)