chiark / gitweb /
stg uncommit should never touch the branch head
[stgit] / t / t1300-uncommit.sh
index a657ead7ed06b7264045a4bd1cefac7570bdbde9..d01eaaa9f90f103c027ae4d940f81d4825e8b554 100755 (executable)
@@ -83,4 +83,15 @@ test_expect_success 'Uncommit a commit with not precisely one parent' '
     [ "$(echo $(stg series))" = "" ]
 '
 
+# stg uncommit should work even when top != head, and should not touch
+# the head.
+test_expect_failure 'Uncommit when top != head' '
+    stg new -m foo &&
+    git reset --hard HEAD^ &&
+    h=$(git rev-parse HEAD)
+    stg uncommit bar &&
+    test $(git rev-parse HEAD) = $h &&
+    test "$(echo $(stg series))" = "+ bar > foo"
+'
+
 test_done