summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 770ea4fe80..defbb3eb05 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -92,15 +92,12 @@ static void find_short_object_filename(int len, const char *hex_pfx, struct disa
xsnprintf(hex, sizeof(hex), "%.2s", hex_pfx);
for (alt = fakeent; alt && !ds->ambiguous; alt = alt->next) {
+ struct strbuf *buf = alt_scratch_buf(alt);
struct dirent *de;
DIR *dir;
- /*
- * every alt_odb struct has 42 extra bytes after the base
- * for exactly this purpose
- */
- xsnprintf(alt->name, 42, "%.2s/", hex_pfx);
- dir = opendir(alt->scratch);
+ strbuf_addf(buf, "%.2s/", hex_pfx);
+ dir = opendir(buf->buf);
if (!dir)
continue;