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

Re: [PATCH 1/1] range-diff: internally force `diff.noprefix=false`

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 2, 2019, 20:30 UTC
Message-ID
<nycvar.QRO.7.76.6.1910022229340.46@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqq4l0qewu5.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Thu, 3 Oct 2019, Junio C Hamano wrote:
Show 11 quoted lines
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > 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.
>
> If so, passing src/dst prefix as command line option is a much better
> solution, I think.  diff.noprefix may not stay to be (or it may
> already not to be) the only thing how the prefix gets chosen.
Good point.

While at it, I invert the logic in v2: instead of forcing a prefix, I now force no prefix (and reduce the strip level from 1 to 0 when parsing the diff header).

Thanks, Dscho

Show 21 quoted lines
>
> > -	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
>
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 11 in “Avoid segmentation fault in git range-diff when diff.noprefix=true”
  1. 0/1 Avoid segmentation fault in git range-diff when diff.noprefix=trueJohannes Schindelin via GitGitGadget, Oct 2, 2019
  2. 1/1 range-diff: internally force `diff.noprefix=false`Johannes Schindelin via GitGitGadget, Oct 2, 2019
  3. Eric SunshineOct 2, 2019
  4. Michal SuchánekOct 2, 2019
  5. Junio C HamanoOct 2, 2019
  6. Johannes SchindelinOct 2, 2019
  7. Junio C HamanoOct 3, 2019
  8. Junio C HamanoOct 3, 2019
  9. 0/1 Avoid segmentation fault in git range-diff when diff.noprefix=trueJohannes Schindelin via GitGitGadget, Oct 2, 2019
  10. 1/1 range-diff: internally force `diff.noprefix=true`Johannes Schindelin via GitGitGadget, Oct 2, 2019
  11. Junio C HamanoOct 3, 2019

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.