@@ -239,6 +239,33 @@ test_expect_success 'old records rest in peace' '
239239 ! test -f $rr2/preimage
240240'
241241
242+ test_expect_success ' rerere gc with custom expiry' '
243+ rm -fr .git/rr-cache &&
244+ rr=.git/rr-cache/$_z40 &&
245+ mkdir -p "$rr" &&
246+ >"$rr/preimage" &&
247+ >"$rr/postimage" &&
248+
249+ two_days_ago=$((-2*86400)) &&
250+ test-chmtime =$two_days_ago "$rr/preimage" &&
251+ test-chmtime =$two_days_ago "$rr/postimage" &&
252+
253+ find .git/rr-cache -type f | sort >original &&
254+
255+ git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
256+ find .git/rr-cache -type f | sort >actual &&
257+ test_cmp original actual &&
258+
259+ git -c gc.rerereresolved=5 -c gc.rerereunresolved=0 rerere gc &&
260+ find .git/rr-cache -type f | sort >actual &&
261+ test_cmp original actual &&
262+
263+ git -c gc.rerereresolved=0 -c gc.rerereunresolved=0 rerere gc &&
264+ find .git/rr-cache -type f | sort >actual &&
265+ >expect &&
266+ test_cmp expect actual
267+ '
268+
242269test_expect_success ' setup: file2 added differently in two branches' '
243270 git reset --hard &&
244271
@@ -419,33 +446,6 @@ count_pre_post () {
419446 test_line_count = " $2 " actual
420447}
421448
422- test_expect_success ' rerere gc' '
423- rm -fr .git/rr-cache &&
424- rr=.git/rr-cache/$_z40 &&
425- mkdir -p "$rr" &&
426- >"$rr/preimage" &&
427- >"$rr/postimage" &&
428-
429- two_days_ago=$((-2*86400)) &&
430- test-chmtime =$two_days_ago "$rr/preimage" &&
431- test-chmtime =$two_days_ago "$rr/postimage" &&
432-
433- find .git/rr-cache -type f | sort >original &&
434-
435- git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
436- find .git/rr-cache -type f | sort >actual &&
437- test_cmp original actual &&
438-
439- git -c gc.rerereresolved=5 -c gc.rerereunresolved=0 rerere gc &&
440- find .git/rr-cache -type f | sort >actual &&
441- test_cmp original actual &&
442-
443- git -c gc.rerereresolved=0 -c gc.rerereunresolved=0 rerere gc &&
444- find .git/rr-cache -type f | sort >actual &&
445- >expect &&
446- test_cmp expect actual
447- '
448-
449449merge_conflict_resolve () {
450450 git reset --hard &&
451451 test_must_fail git merge six.1 &&
0 commit comments