From: Michael J Gruber <git@drmicha•warpmail.net>
To: James McCoy <vega.james@gmail•com>, git@vger•kernel.org
Cc: Jeff King <peff@peff•net>
Subject: Re: [PATCH v2] filter-branch: remove multi-line headers in msg filter
Date: Fri, 9 Oct 2015 09:07:24 +0200 [thread overview]
Message-ID: <561767AC.6060503@drmicha.warpmail.net> (raw)
In-Reply-To: <20151009002113.GA329@freya.jamessan.com>
James McCoy venit, vidit, dixit 09.10.2015 02:21:
> df062010 (filter-branch: avoid passing commit message through sed)
> introduced a regression when filtering commits with multi-line headers,
> if the header contains a blank line. An example of this is a gpg-signed
> commit:
>
> $ git cat-file commit signed-commit
> tree 3d4038e029712da9fc59a72afbfcc90418451630
> parent 110eac945dc1713b27bdf49e74e5805db66971f0
> author A U Thor <author@example•com> 1112912413 -0700
> committer C O Mitter <committer@example•com> 1112912413 -0700
> gpgsig -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iEYEABECAAYFAlYXADwACgkQE7b1Hs3eQw23CACgldB/InRyDgQwyiFyMMm3zFpj
> pUsAnA+f3aMUsd9mNroloSmlOgL6jIMO
> =0Hgm
> -----END PGP SIGNATURE-----
>
> Adding gpg
>
> As a consequence, "filter-branch --msg-filter cat" (which should leave the
> commit message unchanged) spills the signature (after the internal blank
> line) into the original commit message.
>
> The reason is that although the signature is indented, making the line a
> whitespace only line, the “read” call is splitting the line based on
> the shell's IFS, which defaults to <space><tab><newline>. The leading
> space is consumed and $header_line is empty, causing the “skip header
> lines” loop to exit.
>
> The rest of the commit object is then re-used as the rewritten commit
> message, causing the new message to include the signature of the
> original commit.
>
> Set IFS to an empty string for the “read” call, thus disabling the word
> splitting, which causes $header_line to be set to the non-empty value '
> '. This allows the loop to fully consume the header lines before
> emitting the original, intact commit message.
>
> Signed-off-by: James McCoy <vega.james@gmail•com>
> ---
Thanks for hanging in :)
Reviewed-by: Michael J Gruber <git@drmicha•warpmail.net>
next prev parent reply other threads:[~2015-10-09 7:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 0:21 [PATCH v2] filter-branch: remove multi-line headers in msg filter James McCoy
2015-10-09 7:07 ` Michael J Gruber [this message]
2015-10-09 17:53 ` Junio C Hamano
2015-10-12 7:26 ` Michael J Gruber
2015-10-12 16:05 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=561767AC.6060503@drmicha.warpmail.net \
--to=git@drmicha$(echo .)warpmail.net \
--cc=git@vger$(echo .)kernel.org \
--cc=peff@peff$(echo .)net \
--cc=vega.james@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox