Find git executable at run time
[git-darcs-import.git] / tests / impossible_unrevert.sh
blobcbdcb15ee0a145070bfe6ad7d4b91f18de238c76
1 #!/usr/bin/env bash
2 set -ev
4 rm -rf temp
5 mkdir temp
6 cd temp
7 darcs init
8 echo ALL ignore-times > _darcs/prefs/defaults
9 echo a > foo
10 darcs add foo
11 darcs record -a -m aa -A test
12 echo b > foo
13 echo y | darcs revert -a
14 echo y/d/y | tr / \\012 | darcs unrecord
15 # since the unrevert is impossible, we should fail if it succeeds...
16 echo y | darcs unrevert && exit 1 || true
18 # now let's try a possible unrevert, just for fun...
19 echo b >> foo
20 darcs record -a -m bb -A test
21 echo f/b | tr / \\012 > foo
22 darcs record -a -m 'aaa becomes f' -A test
23 date >> foo
24 echo y | darcs revert -a
25 echo y/d/y | tr / \\012 | darcs unpull
26 # Now add the date back on at the end:
27 echo y | darcs unrevert
28 echo 'M ./foo +1' > correct_summary
29 darcs whatsnew --dont-look-for-adds --summary > actual_summary
30 diff -c correct_summary actual_summary
32 cd ..
33 rm -rf temp