diff options
author | Patrick Steinhardt <ps@pks.im> | 2023-04-14 08:01:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-14 19:27:51 +0200 |
commit | 752b465c3c0fd7f503b50c326017b8b13af83c3b (patch) | |
tree | c4147890cb3bef22549dfdca55271c6857189b54 /t/t5331-pack-objects-stdin.sh | |
parent | pack-objects: fix error when packing same pack twice (diff) | |
download | git-752b465c3c0fd7f503b50c326017b8b13af83c3b.tar.xz git-752b465c3c0fd7f503b50c326017b8b13af83c3b.zip |
pack-objects: fix error when same packfile is included and excluded
When passing the same packfile both as included and excluded via the
`--stdin-packs` option, then we will return an error because the
excluded packfile cannot be found. This is because we will only set the
`util` pointer for the included packfile list if it was found, so that
we later die when we notice that it's in fact not set for the excluded
packfile list.
Fix this bug by always setting the `util` pointer for both the included
and excluded list entries.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t5331-pack-objects-stdin.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t5331-pack-objects-stdin.sh b/t/t5331-pack-objects-stdin.sh index 71c8a4a635..3ef736ec05 100755 --- a/t/t5331-pack-objects-stdin.sh +++ b/t/t5331-pack-objects-stdin.sh @@ -169,4 +169,24 @@ test_expect_success 'pack-objects --stdin with duplicate packfile' ' ) ' +test_expect_success 'pack-objects --stdin with same packfile excluded and included' ' + test_when_finished "rm -fr repo" && + + git init repo && + ( + cd repo && + test_commit "commit" && + git repack -ad && + + { + basename .git/objects/pack/pack-*.pack && + printf "^%s\n" "$(basename .git/objects/pack/pack-*.pack)" + } >packfiles && + + git pack-objects --stdin-packs generated-pack <packfiles && + packed_objects generated-pack-*.idx >packed-objects && + test_must_be_empty packed-objects + ) +' + test_done |