t: handle EOF in test_copy_bytes()
[gitweb.git] / t / t7504-commit-msg-hook.sh
index 8728db61d38905d9e3e699cb9f450716e4236017..88d4cda2992496d8ff5643caaaccf53e90dedc3a 100755 (executable)
@@ -220,4 +220,21 @@ test_expect_success "hook doesn't edit commit message (editor)" '
 
 '
 
+# set up fake editor to replace `pick` by `reword`
+cat > reword-editor <<'EOF'
+#!/bin/sh
+mv "$1" "$1".bup &&
+sed 's/^pick/reword/' <"$1".bup >"$1"
+EOF
+chmod +x reword-editor
+REWORD_EDITOR="$(pwd)/reword-editor"
+export REWORD_EDITOR
+
+test_expect_success 'hook is called for reword during `rebase -i`' '
+
+       GIT_SEQUENCE_EDITOR="\"$REWORD_EDITOR\"" git rebase -i HEAD^ &&
+       commit_msg_is "new message"
+
+'
+
 test_done