Follow upstream changes -- Bytestring updates
[git-darcs-import.git] / tests / amend-record.sh
blob7438c9b2bfc59f5ccfc3dd6e5b70ad4e335e02a1
1 #!/usr/bin/env bash
2 set -ev
4 # Testing amend-record.
6 not () { "$@" && exit 1 || :; }
8 rm -rf temp1
9 # set up the repository
10 mkdir temp1
11 cd temp1
12 darcs init
13 cd ..
15 # do some work here
16 cd temp1
17 # Plain amend-record
18 touch foo
19 darcs add foo
20 darcs record -a -m add_foo
21 echo 'another line' > foo
22 echo y | darcs amend -a foo | grep -i 'amending changes'
23 darcs changes -v | grep 'another line'
24 # amend-record of removed file
25 touch bar1
26 touch bar2
27 cat > bar1 << FOO
28 a line
29 b line
30 FOO
31 darcs add bar1 bar2
32 darcs record -a -m add_bars
33 rm -f bar2
34 echo y | darcs amend -a | grep -i 'finished amending'
35 # Special case: patch is empty after amend
36 cp foo foo.old
37 echo 'another line' >> foo
38 darcs record -a -m add_line foo | grep -i 'finished recording'
39 mv foo.old foo
40 echo y | darcs amend -a foo | grep -i 'amending changes'
41 # Amend --author, -m, etc
42 echo "another line" >> foo
43 echo y | darcs amend -a -m new_name foo | grep -i 'amending changes'
44 darcs changes --last=1 | grep new_name
45 echo "another line" >> foo
46 echo y | darcs amend -a -m new_name -A new_author foo | grep -i 'amending changes'
47 darcs changes --last=1 | grep new_author
48 cd ..
50 rm -rf temp1