Re: [PATCH 1/3] diff: use filespec path to set up tempfiles for ext-diff
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 6, 2023, 12:48 UTC
- Message-ID
- <xmqqbknbsu9y.fsf@gitster.g>
- In-Reply-To
- <Y7gAHenwmIo4gXTb@coredump.intra.peff.net>
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" ;-)
Show 9 quoted lines
> 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.
Show 10 quoted lines
> 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);