git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Michal Suchánek" <msuchanek@suse.de>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 1/1] range-diff: internally force `diff.noprefix=false`
Date: Wed, 2 Oct 2019 21:56:46 +0200	[thread overview]
Message-ID: <20191002195646.GF17916@kitsune.suse.cz> (raw)
In-Reply-To: <1f84f92846bc14d21aa7339c8baa0f9bb710b17d.1570039511.git.gitgitgadget@gmail.com>

On Wed, Oct 02, 2019 at 11:05:13AM -0700, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> When parsing the diffs, `range-diff` expects to see the prefixes `a/`
> and `b/` in the diff headers.
> 
> These prefixes can be forced off via the config setting
> `diff.noprefix=true`. As `range-diff` is not prepared for that
> situation, this will cause a segmentation fault.
> 
> Let's avoid that by forcing `diff.noprefix=false` just for that all to
> `git log` that generates the diffs that `range-diff` wants to parse.
> 
> Noticed-by: Michal Suchánek <msuchanek@suse.de>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Michal Suchánek <msuchanek@suse.de>

Thanks

Michal
> ---
>  range-diff.c          | 3 ++-
>  t/t3206-range-diff.sh | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/range-diff.c b/range-diff.c
> index ba1e9a4265..8cc348b4cb 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -50,7 +50,8 @@ static int read_patches(const char *range, struct string_list *list)
>  	int offset, len;
>  	size_t size;
>  
> -	argv_array_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
> +	argv_array_pushl(&cp.args, "-c", "diff.noprefix=false",
> +			"log", "--no-color", "-p", "--no-merges",
>  			"--reverse", "--date-order", "--decorate=no",
>  			/*
>  			 * Choose indicators that are not used anywhere
> diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
> index 0120f769f1..64b66f2094 100755
> --- a/t/t3206-range-diff.sh
> +++ b/t/t3206-range-diff.sh
> @@ -461,4 +461,8 @@ test_expect_success 'format-patch --range-diff as commentary' '
>  	grep "> 1: .* new message" 0001-*
>  '
>  
> +test_expect_success 'range-diff overrides diff.noprefix internally' '
> +	git -c diff.noprefix=true range-diff HEAD^...
> +'
> +
>  test_done
> -- 
> gitgitgadget

  parent reply	other threads:[~2019-10-02 19:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 18:05 [PATCH 0/1] Avoid segmentation fault in git range-diff when diff.noprefix=true Johannes Schindelin via GitGitGadget
2019-10-02 18:05 ` [PATCH 1/1] range-diff: internally force `diff.noprefix=false` Johannes Schindelin via GitGitGadget
2019-10-02 18:34   ` Eric Sunshine
2019-10-02 19:56   ` Michal Suchánek [this message]
2019-10-02 20:06   ` Junio C Hamano
2019-10-02 20:30     ` Johannes Schindelin
2019-10-03  0:43       ` Junio C Hamano
2019-10-03  0:41     ` Junio C Hamano
2019-10-02 21:10 ` [PATCH v2 0/1] Avoid segmentation fault in git range-diff when diff.noprefix=true Johannes Schindelin via GitGitGadget
2019-10-02 21:10   ` [PATCH v2 1/1] range-diff: internally force `diff.noprefix=true` Johannes Schindelin via GitGitGadget
2019-10-03  2:11     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002195646.GF17916@kitsune.suse.cz \
    --to=msuchanek@suse.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).