Re: [PATCH 5/5] Skip blank lines when matching <commit>^{/foo}
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 29, 2016, 22:53 UTC
- Message-ID
- <xmqqh9cb1ub0.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <7cebdcd80a93d1604258e9dc9cb286cd6ba97ba8.1467209576.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 7 quoted lines
> When trying to match a pattern in the commit subject, simply skip leading > blank lines in the commit message. This is consistent with the > pretty-printing machinery: it silently ignores leading blank lines in the > commit object's body. > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > ---
Hmm.
I just tried
$ git commit -s -m ' pull: fast-forward "pull --rebase=true"'
expecting that ":/^ pull:" would find it ;-)
The point of this patch is to make it not work, of course, which may or may not be a good thing. I'd rather keep this separate from the other fixes.
Also 4/5 is another different class of true bugfix, I would suspect, so let's take it on a separate topic that can be merged down to older maintainance tracks.
Thanks.
Show 17 quoted lines
> sha1_name.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sha1_name.c b/sha1_name.c
> index ca7ddd6..da354a5 100644
> --- a/sha1_name.c
> +++ b/sha1_name.c
> @@ -912,7 +912,8 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1,
> continue;
> buf = get_commit_buffer(commit, NULL);
> p = strstr(buf, "\n\n");
> - matches = negative ^ (p && !regexec(®ex, p + 2, 0, NULL, 0));
> + matches = negative ^ (p && !regexec(®ex,
> + skip_blank_lines(p + 2), 0, NULL, 0));
> unuse_commit_buffer(commit, buf);
>
> if (matches) {