git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Mar 20, 2013, 23:36 UTC
Message-ID
<vpqli9hmyov.fsf@grenoble-inp.fr>
In-Reply-To
<b978a77f8a37c47b2d6c2201d1f7cfffa01f8443.1363820289.git.simon@ruderich.org>
Simon Ruderich <simon@ruderich.org> writes:
Show 7 quoted lines
> ---
> 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.
Show 17 quoted lines
> 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/
Previous: Simon RuderichNext: Junio C Hamano
Message 2 of 4 in “git-am: fix "Applying" message when applypatch-hook was run”
  1. git-am: fix "Applying" message when applypatch-hook was runSimon Ruderich, Mar 20, 2013
  2. Matthieu MoyMar 20, 2013
  3. Junio C HamanoMar 20, 2013
  4. Simon RuderichMar 21, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.