receive-pack: quarantine objects until pre-receive accepts
[gitweb.git] / sha1_name.c
index 98152a68ba472ad319daf18147febfe8154178d2..defbb3eb05aa3d82c86549337f9cc56e1f6076bd 100644 (file)
@@ -92,14 +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->base);
+
+               strbuf_addf(buf, "%.2s/", hex_pfx);
+               dir = opendir(buf->buf);
                if (!dir)
                        continue;