Jeff King <peff@xxxxxxxx> 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@xxxxxxxxxxxxx> > Signed-off-by: Jeff King <peff@xxxxxxxx> > --- > 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);