Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-23 00:14:03 +0300
committerJunio C Hamano <gitster@pobox.com>2017-08-23 00:51:02 +0300
commitc277344182b6ff423b8395ea0bf7a75ee0db78e2 (patch)
tree23b7f74dd823d384e394e951776b7f5051f0f776 /t
parent780fbeba63e792199a0974826a5ef0267af83c1a (diff)
t4200: make "rerere gc" test more robust
The test blindly trusted that there may be _some_ entries left in the rerere database, and used them by updating their timestamps to see if the gc threshold variables are honoured correctly. This won't work if there is no entry in the database when the test begins. Instead, clear the rerere database, and populate it with a few known entries (which are bogus, but for the purpose of testing "garbage collection", it does not matter---we want to make sure we collect old cruft, even if the files are corrupt rerere database entries), and use them for the expiry test. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4200-rerere.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 8f5f268baf..1e23031cdb 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -420,19 +420,28 @@ count_pre_post () {
}
test_expect_success 'rerere gc' '
- find .git/rr-cache -type f >original &&
- xargs test-chmtime -172800 <original &&
+ rm -fr .git/rr-cache &&
+ rr=.git/rr-cache/$_z40 &&
+ mkdir -p "$rr" &&
+ >"$rr/preimage" &&
+ >"$rr/postimage" &&
+
+ two_days_ago=$((-2*86400)) &&
+ test-chmtime =$two_days_ago "$rr/preimage" &&
+ test-chmtime =$two_days_ago "$rr/postimage" &&
+
+ find .git/rr-cache -type f | sort >original &&
git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
- find .git/rr-cache -type f >actual &&
+ find .git/rr-cache -type f | sort >actual &&
test_cmp original actual &&
git -c gc.rerereresolved=5 -c gc.rerereunresolved=0 rerere gc &&
- find .git/rr-cache -type f >actual &&
+ find .git/rr-cache -type f | sort >actual &&
test_cmp original actual &&
git -c gc.rerereresolved=0 -c gc.rerereunresolved=0 rerere gc &&
- find .git/rr-cache -type f >actual &&
+ find .git/rr-cache -type f | sort >actual &&
>expect &&
test_cmp expect actual
'