2 test_description
='Test git/StGit interoperability with "stg repair"'
5 test_expect_success
'Create some git-only history' '
10 test_commit_bulk --message="foo%s" --filename=foo.txt --contents="foo%s" 5
13 test_expect_success
'Initialize the StGit repository' '
17 test_expect_success
'Create five patches' '
18 for i in 0 1 2 3 4; do
21 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
22 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
25 test_expect_success
'Pop two patches with git reset' '
26 git reset --hard HEAD~2 &&
27 command_error stg refresh &&
29 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
30 [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
33 test_expect_success
'Create a new patch' '
35 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 q0" ] &&
36 [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
39 test_expect_success
'Go to an unapplied patch with with git reset' '
40 git reset --hard $(stg id p3) &&
41 command_error stg refresh &&
43 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
44 [ "$(echo $(stg series --unapplied --noprefix))" = "q0 p4" ]
47 test_expect_success
'Go back to below the stack base with git reset' '
48 git reset --hard foo-tag &&
50 [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
51 [ "$(echo $(stg series --unapplied --noprefix))" = "p0 p1 p2 p3 q0 p4" ]