diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-02-15 00:05:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-15 00:05:11 -0800 |
commit | 43e35f6bc14c6e00148a01700e3df191aa99c9f7 (patch) | |
tree | d1f5a26891a6f990833bc096f04dc1157aabde48 /t | |
parent | b43174ebf12299ba3da3007c1e759613af153f6c (diff) | |
parent | 58e9d9d472ff4dbc6cfbf7459878778c739395eb (diff) | |
download | git-43e35f6bc14c6e00148a01700e3df191aa99c9f7.tar.gz git-43e35f6bc14c6e00148a01700e3df191aa99c9f7.tar.xz |
Merge branch 'js/gc-prune'
* js/gc-prune:
gc: make --prune useful again by accepting an optional parameter
Diffstat (limited to 't')
-rwxr-xr-x | t/t5304-prune.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index 771c0a06a..55ed7c793 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -112,4 +112,42 @@ test_expect_success 'prune: do not prune heads listed as an argument' ' ' +test_expect_success 'gc --no-prune' ' + + before=$(git count-objects | sed "s/ .*//") && + BLOB=$(echo aleph_0 | git hash-object -w --stdin) && + BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") && + test $((1 + $before)) = $(git count-objects | sed "s/ .*//") && + test -f $BLOB_FILE && + test-chmtime =-$((86400*5001)) $BLOB_FILE && + git config gc.pruneExpire 2.days.ago && + git gc --no-prune && + test 1 = $(git count-objects | sed "s/ .*//") && + test -f $BLOB_FILE + +' + +test_expect_success 'gc respects gc.pruneExpire' ' + + git config gc.pruneExpire 5002.days.ago && + git gc && + test -f $BLOB_FILE && + git config gc.pruneExpire 5000.days.ago && + git gc && + test ! -f $BLOB_FILE + +' + +test_expect_success 'gc --prune=<date>' ' + + BLOB=$(echo aleph_0 | git hash-object -w --stdin) && + BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") && + test-chmtime =-$((86400*5001)) $BLOB_FILE && + git gc --prune=5002.days.ago && + test -f $BLOB_FILE && + git gc --prune=5000.days.ago && + test ! -f $BLOB_FILE + +' + test_done |