Skip to content

Commit c58100a

Browse files
ttaylorrgitster
authored andcommitted
t/t9300-fast-import.sh: prepare for gc --cruft by default
In a similar fashion as previous commits, adjust the fast-import tests to prepare for "git gc" generating a cruft pack by default. This adjustment is slightly different, however. Instead of relying on us writing out the objects loose, and then calling `git prune` to remove them, t9300 needs to be prepared to drop objects that would be moved into cruft packs. To do this, we can combine the `git gc` invocation with `git prune` into one `git gc --prune`, which handles pruning both loose objects, and objects that would otherwise be written to a cruft pack. Likely this pattern of "git gc && git prune" started all the way back in 03db452 (Support gitlinks in fast-import., 2008-07-19), which happened after deprecating `git gc --prune` in 9e7d501 (builtin-gc.c: deprecate --prune, it now really has no effect, 2008-05-09). After `--prune` was un-deprecated in 58e9d9d (gc: make --prune useful again by accepting an optional parameter, 2009-02-14), this script got a handful of new "git gc && git prune" instances via via 4cedb78 (fast-import: add input format tests, 2011-08-11). These could have been `git gc --prune`, but weren't (likely taking after 03db452). Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b9061bc commit c58100a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

t/t9300-fast-import.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,7 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' '
388388
389389
INPUT_END
390390
391-
test_when_finished "rm -f .git/TEMP_TAG
392-
git gc
393-
git prune" &&
391+
test_when_finished "rm -f .git/TEMP_TAG && git gc --prune=now" &&
394392
git fast-import <input &&
395393
test $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d " " ) != "$ZERO_OID" &&
396394
test $(git rev-parse main) = $(git rev-parse TEMP_TAG^)
@@ -406,8 +404,7 @@ test_expect_success 'B: accept empty committer' '
406404
INPUT_END
407405
408406
test_when_finished "git update-ref -d refs/heads/empty-committer-1
409-
git gc
410-
git prune" &&
407+
git gc --prune=now" &&
411408
git fast-import <input &&
412409
out=$(git fsck) &&
413410
echo "$out" &&
@@ -452,8 +449,7 @@ test_expect_success 'B: accept and fixup committer with no name' '
452449
INPUT_END
453450
454451
test_when_finished "git update-ref -d refs/heads/empty-committer-2
455-
git gc
456-
git prune" &&
452+
git gc --prune=now" &&
457453
git fast-import <input &&
458454
out=$(git fsck) &&
459455
echo "$out" &&
@@ -1778,8 +1774,7 @@ test_expect_success 'P: verbatim SHA gitlinks' '
17781774
INPUT_END
17791775
17801776
git branch -D sub &&
1781-
git gc &&
1782-
git prune &&
1777+
git gc --prune=now &&
17831778
git fast-import <input &&
17841779
test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
17851780
'

0 commit comments

Comments
 (0)