2 test_description
='Test git/StGit interoperability with "stg repair"'
5 test_expect_success
'Create some git-only history' '
8 git commit -a -m foo &&
10 for i in 0 1 2 3 4; do
11 echo foo$i >> foo.txt &&
12 git commit -a -m foo$i;
16 test_expect_success
'Initialize the StGit repository' '
20 test_expect_success
'Create five patches' '
21 for i in 0 1 2 3 4; do
24 [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
25 [ "$(echo $(stg unapplied))" = "" ]
28 test_expect_success
'Pop two patches with git-reset' '
29 git reset --hard HEAD~2 &&
33 [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
34 [ "$(echo $(stg unapplied))" = "p3 p4" ]
37 test_expect_success
'Create a new patch' '
39 [ "$(echo $(stg applied))" = "p0 p1 p2 q0" ] &&
40 [ "$(echo $(stg unapplied))" = "p3 p4" ]
43 test_expect_success
'Go to an unapplied patch with with git-reset' '
44 git reset --hard $(stg id p3) &&
48 [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
49 [ "$(echo $(stg unapplied))" = "q0 p4" ]
52 test_expect_success
'Go back to below the stack base with git-reset' '
53 git reset --hard foo-tag &&
55 [ "$(echo $(stg applied))" = "" ] &&
56 [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 q0 p4" ]