Test for generated patchname with trailing period
[stgit.git] / t / t1302-repair-interop.sh
blob7366c6ccc935fe25fb62cdabba0e37a8d93259a2
1 #!/bin/sh
2 test_description='Test git/StGit interoperability with "stg repair"'
3 . ./test-lib.sh
5 test_expect_success 'Create some git-only history' '
6 echo foo > foo.txt &&
7 git add foo.txt &&
8 git commit -m foo &&
9 git tag foo-tag &&
10 test_commit_bulk --message="foo%s" --filename=foo.txt --contents="foo%s" 5
13 test_expect_success 'Initialize the StGit repository' '
14 stg init
17 test_expect_success 'Create five patches' '
18 for i in 0 1 2 3 4; do
19 stg new p$i -m p$i;
20 done &&
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 &&
28 stg repair &&
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' '
34 stg new q0 -m q0 &&
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 &&
42 stg repair &&
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 &&
49 stg repair &&
50 [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
51 [ "$(echo $(stg series --unapplied --noprefix))" = "p0 p1 p2 p3 q0 p4" ]
54 test_done