2 test_description='Test the refresh command from a subdirectory'
6 test_expect_success 'Refresh from a subdirectory' '
10 echo bar >> bar/bar.txt &&
11 git add foo.txt bar/bar.txt &&
15 [ "$(stg status)" = "" ]
18 test_expect_success 'Refresh again' '
19 echo foo2 >> foo.txt &&
20 echo bar2 >> bar/bar.txt &&
24 [ "$(stg status)" = "" ]
27 test_expect_success 'Refresh file in subdirectory' '
28 echo foo3 >> foo.txt &&
29 echo bar3 >> bar/bar.txt &&
31 stg refresh bar.txt &&
33 [ "$(stg status)" = "M foo.txt" ]
36 test_expect_success 'Refresh whole subdirectory' '
37 echo bar4 >> bar/bar.txt &&
39 [ "$(stg status)" = "M foo.txt" ]
42 test_expect_success 'Refresh subdirectories recursively' '
43 echo bar5 >> bar/bar.txt &&
45 [ "$(stg status)" = "" ]
48 test_expect_success 'refresh -u' '
49 echo baz >> bar/baz.txt &&
51 git add bar/baz.txt &&
52 stg refresh --index &&
53 echo xyzzy >> foo.txt &&
54 echo xyzzy >> bar/bar.txt &&
55 echo xyzzy >> bar/baz.txt &&
57 test "$(echo $(stg status))" = "M bar/bar.txt M foo.txt"
60 test_expect_success 'refresh -u -p <subdir>' '
61 echo xyzzy >> bar/baz.txt &&
62 stg refresh -p p0 -u bar &&
63 test "$(echo $(stg status))" = "M bar/baz.txt M foo.txt"
66 test_expect_success 'refresh an unapplied patch' '
69 test "$(stg status)" = "M foo.txt" &&
71 test "$(stg status)" = "" &&
72 test "$(echo $(stg files p1))" = "A bar/baz.txt M foo.txt"