Skip to content

Commit 3cf5f22

Browse files
derrickstoleegitster
authored andcommitted
t7900: clean up some broken refs
The tests for the 'prefetch' task create remotes and fetch refs into 'refs/prefetch/<remote>/' and tags into 'refs/tags/'. These tests use the remotes to create objects not intended to be seen by the "local" repository. In that sense, the incrmental-repack tasks did not have these objects and refs in mind. That test replaces the object directory with a specific pack-file layout for testing the batch-size logic. However, this causes some operations to start showing warnings such as: error: refs/prefetch/remote1/one does not point to a valid object! error: refs/tags/one does not point to a valid object! This only shows up if you run the tests verbosely and watch the output. It caught my eye and I _thought_ that there was a bug where 'git gc' or 'git repack' wouldn't check 'refs/prefetch/' before pruning objects. That is incorrect. Those commands do handle 'refs/prefetch/' correctly. All that is left is to clean up the tests in t7900-maintenance.sh to remove these tags and refs that are not being repacked for the incremental-repack tests. Use update-ref to ensure this works with all ref backends. Helped-by: Taylor Blau <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Reviewed-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 96eaffe commit 3cf5f22

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

t/t7900-maintenance.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ test_expect_success 'incremental-repack task' '
256256
HEAD
257257
^HEAD~1
258258
EOF
259+
260+
# Delete refs that have not been repacked in these packs.
261+
git for-each-ref --format="delete %(refname)" \
262+
refs/prefetch refs/tags >refs &&
263+
git update-ref --stdin <refs &&
264+
265+
# Replace the object directory with this pack layout.
259266
rm -f $packDir/pack-* &&
260267
rm -f $packDir/loose-* &&
261268
ls $packDir/*.pack >packs-before &&

0 commit comments

Comments
 (0)