From cbf731ed4ec511f2c32598e03d7865f35881fea2 Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Fri, 26 Feb 2010 19:50:02 -0800 Subject: prune: honor --expire=never Previously, prune treated an expiration time of 0 to mean that no expire argument was supplied, and everything should be pruned. As a result, "prune --expire=never" would prune all unreachable objects, regardless of their timestamp. prune can be called with --expire=never automatically by gc, when the gc.pruneExpire configuration is set to "never". Signed-off-by: Adam Simpkins Signed-off-by: Junio C Hamano --- t/t5304-prune.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 't') diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index 3c6687abec..e2ed13dba2 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -148,6 +148,38 @@ test_expect_success 'gc --prune=' ' ' +test_expect_success 'gc --prune=never' ' + + add_blob && + git gc --prune=never && + test -f $BLOB_FILE && + git gc --prune=now && + test ! -f $BLOB_FILE + +' + +test_expect_success 'gc respects gc.pruneExpire=never' ' + + git config gc.pruneExpire never && + add_blob && + git gc && + test -f $BLOB_FILE && + git config gc.pruneExpire now && + git gc && + test ! -f $BLOB_FILE + +' + +test_expect_success 'prune --expire=never' ' + + add_blob && + git prune --expire=never && + test -f $BLOB_FILE && + git prune && + test ! -f $BLOB_FILE + +' + test_expect_success 'gc: prune old objects after local clone' ' add_blob && test-chmtime =-$((2*$week+1)) $BLOB_FILE && -- cgit v1.2.3 From 4a9f439415eda734914c7328a2326ee9590246ee Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Fri, 26 Feb 2010 19:50:03 -0800 Subject: reflog: honor gc.reflogexpire=never Previously, if gc.reflogexpire or gc.reflogexpire were set to "never" or "false", the builtin default values were used instead. Signed-off-by: Adam Simpkins Signed-off-by: Junio C Hamano --- t/t1410-reflog.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 't') diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 80af6b9b7e..25046c4208 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -214,4 +214,45 @@ test_expect_success 'delete' ' ' +test_expect_success 'rewind2' ' + + test_tick && git reset --hard HEAD~2 && + loglen=$(wc -l <.git/logs/refs/heads/master) && + test $loglen = 4 + +' + +test_expect_success '--expire=never' ' + + git reflog expire --verbose \ + --expire=never \ + --expire-unreachable=never \ + --all && + loglen=$(wc -l <.git/logs/refs/heads/master) && + test $loglen = 4 + +' + +test_expect_success 'gc.reflogexpire=never' ' + + git config gc.reflogexpire never && + git config gc.reflogexpireunreachable never && + git reflog expire --verbose --all && + loglen=$(wc -l <.git/logs/refs/heads/master) && + test $loglen = 4 +' + +test_expect_success 'gc.reflogexpire=false' ' + + git config gc.reflogexpire false && + git config gc.reflogexpireunreachable false && + git reflog expire --verbose --all && + loglen=$(wc -l <.git/logs/refs/heads/master) && + test $loglen = 4 && + + git config --unset gc.reflogexpire && + git config --unset gc.reflogexpireunreachable + +' + test_done -- cgit v1.2.3