2 test_description
='Test the push command from a subdirectory'
6 test_expect_success
'Create some patches' '
11 echo y$i >> foo/y.txt &&
12 stg add x.txt foo/y.txt &&
15 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
16 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
19 test_expect_success
'Fast-forward push from a subdir' '
21 [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
22 [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
26 [ "$(echo $(cat x.txt))" = "x0 x1 x2" ] &&
27 [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
30 test_expect_success
'Modifying push from a subdir' '
32 [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
33 [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
34 stg new extra -m extra &&
35 echo extra >> extra.txt &&
41 [ "$(echo $(cat x.txt))" = "x0 x1 x2" ] &&
42 [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
45 test_expect_success
'Conflicting push from subdir' '
47 [ "$(echo $(cat x.txt))" = "x0" ] &&
48 [ "$(echo $(cat foo/y.txt))" = "y0" ] &&
50 conflict stg push p2 &&
52 [ "$(echo $(stg status))" = "UU foo/y.txt UU x.txt" ]
55 test_expect_success
'Conflicting add/unknown file in subdir' '
65 command_error stg push foo &&
66 [ "$(stg top)" != "foo" ]