diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-07-06 13:38:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-06 13:38:11 -0700 |
commit | 979f030359f6830fbaebd0c76e9aad5f86993fef (patch) | |
tree | 7f0e68383742902df146706d2387358a96d24f54 /t | |
parent | e25a4ded8a47333a4c71a224927d6df87d7c295e (diff) | |
parent | e26a8c4721ceaf4c59e33bbd4e60f777b7ea9b62 (diff) | |
download | git-979f030359f6830fbaebd0c76e9aad5f86993fef.tar.gz git-979f030359f6830fbaebd0c76e9aad5f86993fef.tar.xz |
Merge branch 'jk/repack-keep-unreachable'
"git repack" learned the "--keep-unreachable" option, which sends
loose unreachable objects to a pack instead of leaving them loose.
This helps heuristics based on the number of loose objects
(e.g. "gc --auto").
* jk/repack-keep-unreachable:
repack: extend --keep-unreachable to loose objects
repack: add --keep-unreachable option
repack: document --unpack-unreachable option
Diffstat (limited to 't')
-rwxr-xr-x | t/t7701-repack-unpack-unreachable.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh index b66e38386..987573c41 100755 --- a/t/t7701-repack-unpack-unreachable.sh +++ b/t/t7701-repack-unpack-unreachable.sh @@ -122,4 +122,32 @@ test_expect_success 'keep packed objects found only in index' ' git cat-file blob :file ' +test_expect_success 'repack -k keeps unreachable packed objects' ' + # create packed-but-unreachable object + sha1=$(echo unreachable-packed | git hash-object -w --stdin) && + pack=$(echo $sha1 | git pack-objects .git/objects/pack/pack) && + git prune-packed && + + # -k should keep it + git repack -adk && + git cat-file -p $sha1 && + + # and double check that without -k it would have been removed + git repack -ad && + test_must_fail git cat-file -p $sha1 +' + +test_expect_success 'repack -k packs unreachable loose objects' ' + # create loose unreachable object + sha1=$(echo would-be-deleted-loose | git hash-object -w --stdin) && + objpath=.git/objects/$(echo $sha1 | sed "s,..,&/,") && + test_path_is_file $objpath && + + # and confirm that the loose object goes away, but we can + # still access it (ergo, it is packed) + git repack -adk && + test_path_is_missing $objpath && + git cat-file -p $sha1 +' + test_done |