chiark / gitweb /
Let some commands work with detached HEAD
[stgit] / t / t2300-refresh-subdir.sh
index d1c7168197fe4e7f2ffa90fbbe9d6218edf029a7..750e4291bb675662eed035c6b7e73557783792f8 100755 (executable)
@@ -15,7 +15,7 @@ test_expect_success 'Refresh from a subdirectory' '
     [ "$(stg status)" = "" ]
 '
 
-test_expect_failure 'Refresh again' '
+test_expect_success 'Refresh again' '
     echo foo2 >> foo.txt &&
     echo bar2 >> bar/bar.txt &&
     cd bar &&
@@ -24,4 +24,25 @@ test_expect_failure 'Refresh again' '
     [ "$(stg status)" = "" ]
 '
 
+test_expect_success 'Refresh file in subdirectory' '
+    echo foo3 >> foo.txt &&
+    echo bar3 >> bar/bar.txt &&
+    cd bar &&
+    stg refresh bar.txt &&
+    cd .. &&
+    [ "$(stg status)" = "M foo.txt" ]
+'
+
+test_expect_success 'Refresh whole subdirectory' '
+    echo bar4 >> bar/bar.txt &&
+    stg refresh bar &&
+    [ "$(stg status)" = "M foo.txt" ]
+'
+
+test_expect_success 'Refresh subdirectories recursively' '
+    echo bar5 >> bar/bar.txt &&
+    stg refresh . &&
+    [ "$(stg status)" = "" ]
+'
+
 test_done