Use README.md in setup.py long_description
[stgit.git] / t / t1201-push-noapply.sh
blobbe2cd3d8b52bbac53c19c875acf7687e13935875
1 #!/bin/sh
3 test_description='Exercise pushing with the --noapply option'
5 . ./test-lib.sh
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 &&
10 stg init &&
11 stg uncommit -n 6 &&
12 stg pop -a &&
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' '
47 stg push -n 3 &&
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' '
64 stg push &&
65 test "$(echo $(stg series --applied --noprefix))" = "b1 b2 b3 a1" &&
66 test "$(echo $(stg series --unapplied --noprefix))" = "a3 a2" &&
67 conflict stg push &&
68 echo "line 3" > a.txt &&
69 stg add a.txt &&
70 stg refresh &&
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' '
76 stg pop -n 2 &&
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"
85 test_done