Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] git-am: fix "Applying" message when applypatch-hook was run

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:56:28

Simon Ruderich [off-list ref] writes:
---
Hello,

This patch fixes a minor issue with git-am. When the
applypatch-hook modifies the commit message, git-am displays the
original message. This patch updates the message to use the
modified version.
Please, read SubmittingPatches in the Documentation directory of Git's
source tree. Your text above should be a commit message (hence, no
hello), and should not be below the --- line.

Also, read about signed-off-by in the same document.
quoted hunk
diff --git a/git-am.sh b/git-am.sh
index 202130f..0997077 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -795,6 +795,14 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
 	then
 		"$GIT_DIR"/hooks/applypatch-msg "$dotest/final-commit" ||
 		stop_here $this
+
+		# applypatch-msg can update the commit message.
+		if test -f "$dotest/final-commit"
+		then
+			FIRSTLINE=$(sed 1q "$dotest/final-commit")
+		else
+			FIRSTLINE=""
+		fi
 	fi
This copy/paste a piece of code that is already a few lines above. Is
there any reason not to _move_ the assignment to FIRSTLINE after the "if
test -x "$GIT_DIR"/hooks/applypatch-msg", to avoid duplicating?

Thanks,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help