3 test_description
='Exercise pushing with the --noapply option'
7 test_expect_success
'Setup patches' '
8 test_commit_bulk --message="a%s" --filename=a.txt --contents="line %s" 3 &&
9 test_commit_bulk --message="b%s" --filename=b.txt --contents="line %s" 3 &&
13 test "$(echo $(stg series --unapplied --noprefix))" = "a1 a2 a3 b1 b2 b3"
16 test_expect_success
'Check --noapply with --all' '
17 command_error stg push --noapply --all 2>&1 |
18 grep -e "Cannot use --noapply with --all"
21 test_expect_success
'Check --noapply with --number' '
22 command_error stg push --noapply -n 3 2>&1 |
23 grep -e "Cannot use --noapply with --number"
26 test_expect_success
'Check --noapply without patch names' '
27 command_error stg push --noapply 2>&1 |
28 grep -e "Must supply patch names with --noapply"
31 test_expect_success
'Check --noapply with --set-tree' '
32 command_error stg push --noapply --set-tree b1 b2 b3 2>&1 |
33 grep -e "Cannot use --noapply with --set-tree"
36 test_expect_success
'Check --noapply with --merged' '
37 command_error stg push --noapply -m b1 b2 b3 2>&1 |
38 grep -e "Cannot use --noapply with --merged"
41 test_expect_success
'Reorder patches b1 b2 b3' '
42 stg push --noapply b1 b2 b3 &&
43 test "$(echo $(stg series --unapplied --noprefix))" = "b1 b2 b3 a1 a2 a3"
46 test_expect_success
'Push reorded patches b1 b2 b3' '
48 test "$(echo $(stg series --applied --noprefix))" = "b1 b2 b3" &&
49 test "$(echo $(stg series --unapplied --noprefix))" = "a1 a2 a3"
52 test_expect_success
'Attempt push --noapply on applied patch' '
53 command_error stg push --noapply b1 2>&1 |
54 grep -e "Patch already applied: b1"
57 test_expect_success
'Reorder patches to cause a latent conflict' '
58 stg push --noapply a1 a3 &&
59 test "$(echo $(stg series --applied --noprefix))" = "b1 b2 b3" &&
60 test "$(echo $(stg series --unapplied --noprefix))" = "a1 a3 a2"
63 test_expect_success
'Observe latent conflict with regular push' '
65 test "$(echo $(stg series --applied --noprefix))" = "b1 b2 b3 a1" &&
66 test "$(echo $(stg series --unapplied --noprefix))" = "a3 a2" &&
68 echo "line 3" > a.txt &&
71 test "$(echo $(stg series --applied --noprefix))" = "b1 b2 b3 a1 a3" &&
72 test "$(echo $(stg series --unapplied --noprefix))" = "a2"
75 test_expect_success
'Push allowed with dirty worktree' '
77 echo "foobar" > b.txt &&
78 test_when_finished git checkout b.txt &&
79 test "$(stg status b.txt)" = " M b.txt" &&
80 stg push --noapply a1 a2 a3 &&
81 test "$(echo $(stg series --applied --noprefix))" = "b1 b2 b3" &&
82 test "$(echo $(stg series --unapplied --noprefix))" = "a1 a2 a3"