git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Carl Baldwin <carl@ecbaldwin.net>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 1/3] diff: use filespec path to set up tempfiles for ext-diff
Date: Fri, 06 Jan 2023 21:48:57 +0900	[thread overview]
Message-ID: <xmqqbknbsu9y.fsf@gitster.g> (raw)
In-Reply-To: <Y7gAHenwmIo4gXTb@coredump.intra.peff.net> (Jeff King's message of "Fri, 6 Jan 2023 06:03:57 -0500")

Jeff King <peff@peff.net> writes:

> We can fix this by passing the pathname from the diff_filespec, which
> should always be a full repository path (and that's what we want even if
> reusing a worktree file, since we're always operating from the top-level
> of the working tree).

Very sensible.

> The breakage seems to go all the way back to cd676a5136 (diff
> --relative: output paths as relative to the current subdirectory,
> 2008-02-12).

Not surprising.  When I wrote all the rest of "diff", I didn't
plan to do "--relative" ;-)

> So the only bug is just the interaction with external diff drivers and
> --relative.
>
> Reported-by: Carl Baldwin <carl@ecbaldwin.net>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  diff.c                   |  2 +-
>  t/t4045-diff-relative.sh | 29 +++++++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 1 deletion(-)

Thanks for a clear description.  The fix looks trivially obvious and
correct.

> diff --git a/diff.c b/diff.c
> index 9b14543e6e..59039773a1 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -4281,7 +4281,7 @@ static void add_external_diff_name(struct repository *r,
>  				   const char *name,
>  				   struct diff_filespec *df)
>  {
> -	struct diff_tempfile *temp = prepare_temp_file(r, name, df);
> +	struct diff_tempfile *temp = prepare_temp_file(r, df->path, df);

  reply	other threads:[~2023-01-06 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 22:03 Problem with git diff --relative, diff.external, run from a sub-directory Carl Baldwin
2023-01-06 11:00 ` [PATCH 0/3] fixing "diff --relative" with external diff Jeff King
2023-01-06 11:03   ` [PATCH 1/3] diff: use filespec path to set up tempfiles for ext-diff Jeff King
2023-01-06 12:48     ` Junio C Hamano [this message]
2023-01-06 13:10       ` Jeff King
2023-01-06 11:04   ` [PATCH 2/3] diff: clean up external-diff argv setup Jeff King
2023-01-06 11:05   ` [PATCH 3/3] diff: drop "name" parameter from prepare_temp_file() Jeff King

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=xmqqbknbsu9y.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=carl@ecbaldwin.net \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).