@matheusbsbs / matheus-bagliano / commits / fa1b4d2ace
Fork 0

t4200: skip gc-rerere test on systems with non GNU date.

Quite nonstandard "date -d @11111111 +%s" does not even fail on OpenBSD but gives the current date in "seconds since epoch" format, which is useless for the purpose of this test. We want to make sure that this returns exactly the same input before proceeding. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 7, 2007 at 10:42 UTC fa1b4d2ace9bbd7edbcbf9bd41f2cc4f7f6b616e
1 file changed +17 -20
t/t4200-rerere.sh
+17 -20
@@ -113,8 +113,11 @@ mkdir $rr2
113 echo Hello > $rr2/preimage
114
115 case "$(date -d @11111111 +%s 2>/dev/null)" in
116 -[1-9]*)
117 - # it is a recent GNU date. good.
116 +11111111)
117 + # 'date' must be able to take arbitrary input with @11111111 notation.
118 + # for this test to succeed. We should fix this part using more
119 + # portable script someday.
120 +
121 now=$(date +%s)
122 almost_15_days_ago=$(($now+60-15*86400))
123 just_over_15_days_ago=$(($now-1-15*86400))
@@ -124,30 +127,24 @@ case "$(date -d @11111111 +%s 2>/dev/null)" in
127 predate2="$(date -d "@$almost_15_days_ago" +%Y%m%d%H%M.%S)"
128 postdate1="$(date -d "@$just_over_60_days_ago" +%Y%m%d%H%M.%S)"
129 postdate2="$(date -d "@$just_over_15_days_ago" +%Y%m%d%H%M.%S)"
127 - ;;
128 -*)
129 - # it is not GNU date. oh, well.
130 - predate1="$(date +%Y%m%d%H%M.%S)"
131 - predate2="$(date +%Y%m%d%H%M.%S)"
132 - postdate1='200610010000.00'
133 - postdate2='200612010000.00'
134 -esac
130
136 -touch -m -t "$predate1" $rr/preimage
137 -touch -m -t "$predate2" $rr2/preimage
131 + touch -m -t "$predate1" $rr/preimage
132 + touch -m -t "$predate2" $rr2/preimage
133
139 -test_expect_success 'garbage collection (part1)' 'git rerere gc'
134 + test_expect_success 'garbage collection (part1)' 'git rerere gc'
135
141 -test_expect_success 'young records still live' \
142 - "test -f $rr/preimage -a -f $rr2/preimage"
136 + test_expect_success 'young records still live' \
137 + "test -f $rr/preimage -a -f $rr2/preimage"
138
144 -touch -m -t "$postdate1" $rr/preimage
145 -touch -m -t "$postdate2" $rr2/preimage
139 + touch -m -t "$postdate1" $rr/preimage
140 + touch -m -t "$postdate2" $rr2/preimage
141
147 -test_expect_success 'garbage collection (part2)' 'git rerere gc'
142 + test_expect_success 'garbage collection (part2)' 'git rerere gc'
143
149 -test_expect_success 'old records rest in peace' \
150 - "test ! -f $rr/preimage -a ! -f $rr2/preimage"
144 + test_expect_success 'old records rest in peace' \
145 + "test ! -f $rr/preimage -a ! -f $rr2/preimage"
146 + ;;
147 +esac
148
149 test_done
150