chiark / gitweb /
Test that stg coalesce handles head != top gracefully
authorKarl Hasselström <kha@treskal.com>
Sun, 21 Sep 2008 12:17:42 +0000 (14:17 +0200)
committerKarl Hasselström <kha@treskal.com>
Sun, 21 Sep 2008 12:19:07 +0000 (14:19 +0200)
It currently doesn't quite: it will roll back the transaction just
fine, but not before asking the user for a commit message which is
lost in the rollback.

Bug discovered by Erik Sandberg <mandolaerik@gmail.com>:
https://gna.org/bugs/?12204

Signed-off-by: Karl Hasselström <kha@treskal.com>
t/t2600-coalesce.sh

index ef5bf995165d3810df10ab3d144ba8c8eba76f5e..33c073daa329b0505dc4f067d9b258bc93bf6c8f 100755 (executable)
@@ -28,4 +28,17 @@ test_expect_success 'Coalesce at stack top' '
     [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
 '
 
     [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
 '
 
+cat > editor <<EOF
+#!/bin/sh
+echo "Editor was invoked" | tee editor-invoked
+EOF
+chmod a+x editor
+test_expect_failure 'Coalesce with top != head' '
+    echo blahonga >> foo.txt &&
+    git commit -a -m "a new commit" &&
+    EDITOR=./editor command_error stg coalesce --name=r0 p0 q1 &&
+    test "$(echo $(stg series))" = "+ p0 > q1" &&
+    test ! -e editor-invoked
+'
+
 test_done
 test_done