3 test_description
='Test float --noapply'
7 test_expect_success
'Initialize the StGit repository' '
8 test_commit_bulk --message="p%s" 4 &&
11 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4"
14 test_expect_success
'Float single applied patch' '
15 stg float --noapply p1 &&
16 test "$(echo $(stg series --applied --noprefix))" = "p2 p3 p4" &&
17 test "$(echo $(stg series --unapplied --noprefix))" = "p1"
20 test_expect_success
'Float multiple applied patches' '
21 stg float --noapply p2 p4 &&
22 test "$(echo $(stg series --applied --noprefix))" = "p3" &&
23 test "$(echo $(stg series --unapplied --noprefix))" = "p2 p4 p1"
26 test_expect_success
'Float unapplied applied patches' '
27 stg float --noapply p1 p2 p4 &&
28 test "$(echo $(stg series --applied --noprefix))" = "p3" &&
29 test "$(echo $(stg series --unapplied --noprefix))" = "p1 p2 p4"
32 test_expect_success
'Float applied and unapplied patches' '
33 stg float --noapply p1 p2 p3 p4 &&
34 test "$(echo $(stg series --applied --noprefix))" = "" &&
35 test "$(echo $(stg series --unapplied --noprefix))" = "p1 p2 p3 p4"
38 test_expect_success
'Float series' '
39 printf "p4\np3\np2\np1\n" |
40 stg float --noapply --series=- &&
41 test "$(echo $(stg series --applied --noprefix))" = "" &&
42 test "$(echo $(stg series --unapplied --noprefix))" = "p4 p3 p2 p1"
45 test_expect_success
'Unclean worktree and floating only unapplied' '
47 test "$(echo $(stg series --unapplied --noprefix))" = "p3 p2 p1" &&
48 echo "foobar" > 4.t &&
49 test_when_finished git checkout 4.t &&
50 test "$(stg status 4.t)" = " M 4.t" &&
51 stg float --noapply p1 p2 p3 &&
52 test "$(echo $(stg series --unapplied --noprefix))" = "p1 p2 p3"
55 test_expect_success
'Unclean worktree and floating applied patches' '
57 test "$(echo $(stg series --applied --noprefix))" = "p4 p1" &&
58 test "$(echo $(stg series --unapplied --noprefix))" = "p2 p3" &&
59 echo "foobar" > 4.t &&
60 test_when_finished git checkout 4.t &&
61 test "$(stg status 4.t)" = " M 4.t" &&
62 command_error stg float --noapply p4 2>&1 |
63 grep -e "Worktree not clean"