git commit -q -a -m "prefer first over second" &&
test -f $rr/postimage &&
+ oldmtimepost=$(test-chmtime -v -60 $rr/postimage | cut -f 1) &&
+
git checkout -b third master &&
git show second^:a1 | sed "s/To die: t/To die! T/" >a1 &&
git commit -q -a -m third &&
test_cmp expect a1
'
+test_expect_success 'rerere updates postimage timestamp' '
+ newmtimepost=$(test-chmtime -v +0 $rr/postimage | cut -f 1) &&
+ test $oldmtimepost -lt $newmtimepost
+'
+
test_expect_success 'rerere clear' '
rm $rr/postimage &&
echo "$sha1 a1" | perl -pe "y/\012/\000/" >.git/MERGE_RR &&
almost_60_days_ago=$((60-60*86400)) &&
just_over_60_days_ago=$((-1-60*86400)) &&
- test-chmtime =$almost_60_days_ago $rr/preimage &&
+ test-chmtime =$just_over_60_days_ago $rr/preimage &&
+ test-chmtime =$almost_60_days_ago $rr/postimage &&
test-chmtime =$almost_15_days_ago $rr2/preimage
'
-test_expect_success 'garbage collection preserves young records' '
+test_expect_success 'gc preserves young or recently used records' '
git rerere gc &&
test -f $rr/preimage &&
test -f $rr2/preimage
'
test_expect_success 'old records rest in peace' '
- test-chmtime =$just_over_60_days_ago $rr/preimage &&
+ test-chmtime =$just_over_60_days_ago $rr/postimage &&
test-chmtime =$just_over_15_days_ago $rr2/preimage &&
git rerere gc &&
! test -f $rr/preimage &&