All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Carl Baldwin <carl@ecbaldwin.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 0/3] fixing "diff --relative" with external diff
Date: Fri, 6 Jan 2023 06:00:50 -0500	[thread overview]
Message-ID: <Y7f/YiVu1TgbucDI@coredump.intra.peff.net> (raw)
In-Reply-To: <CALiLy7raQsK3j+f6+dpYrEiegvFZRra5F9JwPWu---4h_AR49w@mail.gmail.com>

On Wed, Jan 04, 2023 at 03:03:17PM -0700, Carl Baldwin wrote:

> What did you expect to happen? (Expected behavior)
> 
>     When using a diff.external command with --relative, the diff output should
>     show the minor change that I made to the file.
> 
> What happened instead? (Actual behavior)
> 
>     The diff output shows the entire old contents of the file as deleted. The
>     header of the patch looked like this (indent added for this report):

Nice catch, and thank you for a clear reproduction recipe. It looks like
this bug has been lurking since --relative was introduced in 2008. :)

Here's a patch series which fixes it. The first one is the fix itself,
and the other two are some cleanups we can do on top (I almost squashed
them in, but their diffs are rather noisy and make it harder to see the
actual fix).

  [1/3]: diff: use filespec path to set up tempfiles for ext-diff
  [2/3]: diff: clean up external-diff argv setup
  [3/3]: diff: drop "name" parameter from prepare_temp_file()

 diff.c                   | 30 +++++++++++++-----------------
 t/t4045-diff-relative.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 17 deletions(-)

-Peff

  reply	other threads:[~2023-01-06 11:01 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 ` Jeff King [this message]
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
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=Y7f/YiVu1TgbucDI@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=carl@ecbaldwin.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.