Use standard -t option for touch.
Non-GNU touch do not have the -d option to take free form date strings. The POSIX -t option should be more widespread. For this to work, date needs to output YYYYMMDDHHMM.SS date strings. Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Simon 'corecode' Schubert committed
Jan 18, 2007 at 11:18 UTC
4700951298ec75283c71e3daa9b18007adc195a2
1 file changed
+12
-12
t/t4200-rerere.sh
+12
-12
@@ -120,29 +120,29 @@ case "$(date -d @11111111 +%s 2>/dev/null)" in
120
just_over_15_days_ago=$(($now-1-15*86400))
121
almost_60_days_ago=$(($now+60-60*86400))
122
just_over_60_days_ago=$(($now-1-60*86400))
123
- predate1="$(date -d "@$almost_60_days_ago" +%c)"
124
- predate2="$(date -d "@$almost_15_days_ago" +%c)"
125
- postdate1="$(date -d "@$just_over_60_days_ago" +%c)"
126
- postdate2="$(date -d "@$just_over_15_days_ago" +%c)"
123
+ predate1="$(date -d "@$almost_60_days_ago" +%Y%m%d%H%M.%S)"
124
+ predate2="$(date -d "@$almost_15_days_ago" +%Y%m%d%H%M.%S)"
125
+ postdate1="$(date -d "@$just_over_60_days_ago" +%Y%m%d%H%M.%S)"
126
+ 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)"
131
- predate2="$(date)"
132
- postdate1='1 Oct 2006 00:00:00'
133
- postdate2='1 Dec 2006 00:00:00'
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
135
136
-touch -m -d "$predate1" $rr/preimage
137
-touch -m -d "$predate2" $rr2/preimage
136
+touch -m -t "$predate1" $rr/preimage
137
+touch -m -t "$predate2" $rr2/preimage
138
139
test_expect_success 'garbage collection (part1)' 'git rerere gc'
140
141
test_expect_success 'young records still live' \
142
"test -f $rr/preimage -a -f $rr2/preimage"
143
144
-touch -m -d "$postdate1" $rr/preimage
145
-touch -m -d "$postdate2" $rr2/preimage
144
+touch -m -t "$postdate1" $rr/preimage
145
+touch -m -t "$postdate2" $rr2/preimage
146
147
test_expect_success 'garbage collection (part2)' 'git rerere gc'
148