Skip to content

Commit 221d062

Browse files
committed
Merge branch 'ps/pack-concat-wo-backfill' into next
"git pack-objects --stdin-packs" with "--exclude-promisor-objects" fetched objects that are promised, which was not wanted. This has been fixed. * ps/pack-concat-wo-backfill: builtin/pack-objects: don't fetch objects when merging packs
2 parents 406e4cc + f4eff71 commit 221d062

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

builtin/pack-objects.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3924,8 +3924,16 @@ static void add_unreachable_loose_objects(struct rev_info *revs);
39243924

39253925
static void read_stdin_packs(enum stdin_packs_mode mode, int rev_list_unpacked)
39263926
{
3927+
int prev_fetch_if_missing = fetch_if_missing;
39273928
struct rev_info revs;
39283929

3930+
/*
3931+
* The revision walk may hit objects that are promised, only. As the
3932+
* walk is best-effort though we don't want to perform backfill fetches
3933+
* for them.
3934+
*/
3935+
fetch_if_missing = 0;
3936+
39293937
repo_init_revisions(the_repository, &revs, NULL);
39303938
/*
39313939
* Use a revision walk to fill in the namehash of objects in the include
@@ -3961,6 +3969,8 @@ static void read_stdin_packs(enum stdin_packs_mode mode, int rev_list_unpacked)
39613969
stdin_packs_found_nr);
39623970
trace2_data_intmax("pack-objects", the_repository, "stdin_packs_hints",
39633971
stdin_packs_hints_nr);
3972+
3973+
fetch_if_missing = prev_fetch_if_missing;
39643974
}
39653975

39663976
static void add_cruft_object_entry(const struct object_id *oid, enum object_type type,

t/t5331-pack-objects-stdin.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,24 @@ test_expect_success '--stdin-packs with promisors' '
358358
)
359359
'
360360

361+
test_expect_success '--stdin-packs does not perform backfill fetch' '
362+
test_when_finished "rm -rf remote client" &&
363+
364+
git init remote &&
365+
test_commit_bulk -C remote 10 &&
366+
git -C remote config set --local uploadpack.allowfilter 1 &&
367+
git -C remote config set --local uploadpack.allowanysha1inwant 1 &&
368+
369+
git clone --filter=tree:0 "file://$(pwd)/remote" client &&
370+
(
371+
cd client &&
372+
ls .git/objects/pack/*.promisor | sed "s|.*/||; s/\.promisor$/.pack/" >packs &&
373+
test_line_count -gt 1 packs &&
374+
GIT_TRACE2_EVENT="$(pwd)/event.log" git pack-objects --stdin-packs pack <packs &&
375+
test_grep ! "\"event\":\"child_start\"" event.log
376+
)
377+
'
378+
361379
stdin_packs__follow_with_only () {
362380
rm -fr stdin_packs__follow_with_only &&
363381
git init stdin_packs__follow_with_only &&

0 commit comments

Comments
 (0)