2 # Copyright (c) 2006 Karl Hasselström
3 test_description
='Test the repair command.'
7 'Repair in a non-initialized repository' \
8 'command_error stg repair'
11 'Initialize the StGIT repository' \
15 'Repair in a repository without patches' \
28 'Repair when there is nothing to do' \
32 'Create a GIT commit' \
39 test_expect_success
'Turn one GIT commit into a patch' '
40 [ $(stg series --applied -c) -eq 1 ] &&
42 [ $(stg series --applied -c) -eq 2 ]
46 'Create three more GIT commits' \
48 echo one > numbers.txt &&
49 git add numbers.txt &&
50 git commit -a -m one &&
51 echo two >> numbers.txt &&
52 git commit -a -m two &&
53 echo three >> numbers.txt &&
54 git commit -a -m three
57 test_expect_success
'Turn three GIT commits into patches' '
58 [ $(stg series --applied -c) -eq 2 ] &&
60 [ $(stg series --applied -c) -eq 5 ]
64 'Create a merge commit' \
66 git checkout -b br master^^ &&
67 echo woof > woof.txt &&
69 git commit -a -m woof &&
70 git checkout master &&
74 test_expect_success
'Repair in the presence of a merge commit' '
75 [ $(stg series --applied -c) -eq 5 ] &&
77 [ $(stg series --applied -c) -eq 0 ]