path: root/t/
diff options
authorJay Soffian <>2011-10-08 18:39:52 (GMT)
committerJunio C Hamano <>2011-10-12 20:17:18 (GMT)
commit66f4b98ad9a8218ad97b7b2f1604b205072dda62 (patch)
treebe94cc4c5e014b0f932a6a1d46901961a23478d8 /t/
parent703f05ad5835cff92b12c29aecf8d724c8c847e2 (diff)
Teach merge the '[-e|--edit]' option
Implemented internally instead of as "git merge --no-commit && git commit" so that "merge --edit" is otherwise consistent (hooks, etc) with "merge". Note: the edit message does not include the status information that one gets with "commit --status" and it is cleaned up after editing like one gets with "commit --cleanup=default". A later patch could add the status information if desired. Note: previously we were not calling stripspace() after running the prepare-commit-msg hook. Now we are, stripping comments and leading/trailing whitespace lines if --edit is given, otherwise only stripping leading/trailing whitespace lines if not given --edit. Signed-off-by: Jay Soffian <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 23 insertions, 0 deletions
diff --git a/t/ b/t/
index 87aac83..3008e4e 100755
--- a/t/
+++ b/t/
@@ -643,4 +643,27 @@ test_expect_success 'amending no-ff merge commit' '
test_debug 'git log --graph --decorate --oneline --all'
+cat >editor <<\EOF
+# Add a new message string that was not in the template
+ echo "Merge work done on the side branch c1"
+ echo
+ cat <"$1"
+) >"$1.tmp" && mv "$1.tmp" "$1"
+# strip comments and blank lines from end of message
+sed -e '/^#/d' < "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > expected
+chmod 755 editor
+test_expect_success 'merge --no-ff --edit' '
+ git reset --hard c0 &&
+ EDITOR=./editor git merge --no-ff --edit c1 &&
+ verify_parents $c0 $c1 &&
+ git cat-file commit HEAD >raw &&
+ grep "work done on the side branch" raw &&
+ sed "1,/^$/d" >actual raw &&
+ test_cmp actual expected