From: Junio C Hamano Date: Mon, 17 Oct 2016 20:25:19 +0000 (-0700) Subject: Merge branch 'jk/alt-odb-cleanup' X-Git-Tag: v2.11.0-rc0~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dec040192fde87fb3249a3d53f802decd84fa7b7;p=thirdparty%2Fgit.git Merge branch 'jk/alt-odb-cleanup' Codepaths involved in interacting alternate object store have been cleaned up. * jk/alt-odb-cleanup: alternates: use fspathcmp to detect duplicates sha1_file: always allow relative paths to alternates count-objects: report alternates via verbose mode fill_sha1_file: write into a strbuf alternates: store scratch buffer as strbuf fill_sha1_file: write "boring" characters alternates: use a separate scratch space alternates: encapsulate alt->base munging alternates: provide helper for allocating alternate alternates: provide helper for adding to alternates list link_alt_odb_entry: refactor string handling link_alt_odb_entry: handle normalize_path errors t5613: clarify "too deep" recursion tests t5613: do not chdir in main process t5613: whitespace/style cleanups t5613: use test_must_fail t5613: drop test_valid_repo function t5613: drop reachable_via function --- dec040192fde87fb3249a3d53f802decd84fa7b7 diff --cc sha1_name.c index 3b647fd7cf,defbb3eb05..4092836146 --- a/sha1_name.c +++ b/sha1_name.c @@@ -100,16 -90,14 +95,14 @@@ static void find_short_object_filename( } fakeent->next = alt_odb_list; - xsnprintf(hex, sizeof(hex), "%.2s", hex_pfx); + xsnprintf(hex, sizeof(hex), "%.2s", ds->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/", ds->hex_pfx); - dir = opendir(alt->base); + - strbuf_addf(buf, "%.2s/", hex_pfx); ++ strbuf_addf(buf, "%.2s/", ds->hex_pfx); + dir = opendir(buf->buf); if (!dir) continue;