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

Re: [PATCH] git-am: don't ignore --keep (-k) option

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 27, 2009, 20:03 UTC
Message-ID
<7vy6lrka69.fsf@alter.siamese.dyndns.org>
In-Reply-To
<87638zm38r.fsf_-_@meyering.net>
Jim Meyering <jim@meyering.net> writes:
Show 12 quoted lines
> I started looking at git-am.sh and spotted what appears to be a typo.
> There is only that one use of $keep_subject, so its value currently
> comes from the environment.
>
> From 02f7e6433b5db8b18a4cccf58c302159c2f54fa5 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@redhat.com>
> Date: Wed, 25 Nov 2009 09:10:46 +0100
> Subject: [PATCH] git-am: don't ignore --keep (-k) option
>
> Fix typo in variable name: s/keep_subject/keep/.
>
> Signed-off-by: Jim Meyering <meyering@redhat.com>

At the level of "what does each line of the code do", this is a fix, but as we do a lot more than just stripping "[PATCH] " from the beginning of the Subject: line these days, I think we are better off declaring defeat in this particular codepath and not doing anything here.

Adding "[PATCH] " is no longer "keeping the original subject" anyway. It is "without knowing what we already stripped, adding one random string that could have been what we removed".

I also have to wonder why $dotest/info does not have the [PATCH] or whatever prefix that we were told not to strip in this codepath. After all, we are running "git mailinfo" with $keep option to produce that file, so if that part is working correctly, we shouldn't even have to have this "add [PATCH] back" trick to begin with.

What am I missing???
Show 19 quoted lines
> ---
>  git-am.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/git-am.sh b/git-am.sh
> index 151512a..f353e73 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -578,7 +578,7 @@ do
>  			sed -e '1,/^$/d' >"$dotest/msg-clean"
>  		else
>  			SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
> -			case "$keep_subject" in -k)  SUBJECT="[PATCH] $SUBJECT" ;; esac
> +			case "$keep" in -k)  SUBJECT="[PATCH] $SUBJECT" ;; esac
>
>  			(printf '%s\n\n' "$SUBJECT"; cat "$dotest/msg") |
>  				git stripspace > "$dotest/msg-clean"
> --
> 1.6.6.rc0.236.ge0b94
Previous: Jim MeyeringNext: Jim Meyering
Message 4 of 6 in “mailinfo: remove [PATCH...] prefix from Subject regardless of length”
  1. mailinfo: remove [PATCH...] prefix from Subject regardless of lengthJim Meyering, Nov 24, 2009
  2. Junio C HamanoNov 25, 2009
  3. git-am: don't ignore --keep (-k) optionJim Meyering, Nov 25, 2009
  4. Junio C HamanoNov 27, 2009
  5. Jim MeyeringNov 27, 2009
  6. Junio C HamanoNov 27, 2009

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.