Follow upstream changes -- rest
[git-darcs-import.git] / tests / time-stamps.sh
blob4310eca216c06a62f95feb91bc3dedc21090ae0b
1 #!/usr/bin/env bash
3 # test for broken time stamps
5 set -ev
7 not () { "$@" && exit 1 || :; }
9 rm -rf temp
10 mkdir temp
11 cd temp
12 darcs init --hashed
14 echo this is my favorite test > foobar
15 darcs add foobar
16 sleep 2 # so the time stamps won't accidentally be identical
17 darcs record -am 'add foobar'
19 HASHVAL=0000000025-4cbbfd8ce543076b132b13b60ae06d0189ee80b4d5908abb5e060d331d25eb5c
21 if test -d _darcs/pristine.hashed;
22 then
23 ls _darcs/pristine.hashed
24 test -f _darcs/pristine.hashed/$HASHVAL
25 # verify that the modification time of the file in the pristine cache
26 # is identical to the modification time of the file in the working
27 # directory.
28 not test foobar -ot _darcs/pristine.hashed/$HASHVAL
29 not test foobar -nt _darcs/pristine.hashed/$HASHVAL
30 else
31 not test foobar -ot _darcs/pristine/foobar
32 not test foobar -nt _darcs/pristine/foobar
35 # Now let's verify that the test actually works...
37 sleep 1
38 touch foobar
40 if test -d _darcs/pristine.hashed;
41 then
42 not test foobar -ot _darcs/pristine.hashed/$HASHVAL
43 test foobar -nt _darcs/pristine.hashed/$HASHVAL
44 else
45 not test foobar -ot _darcs/pristine/foobar
46 test foobar -nt _darcs/pristine/foobar
50 cd ..
52 rm -rf temp