From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: "Haokai Ding via GitGitGadget" <gitgitgadget@gmail.com>,
git@vger.kernel.org, "René Scharfe" <l.s.r@web.de>,
"Haokai Ding" <hk_ding@outlook.com>
Subject: Re: [PATCH] diff --no-index: fix -R with file/directory conflicts
Date: Mon, 21 Sep 2026 11:01:18 -0700 [thread overview]
Message-ID: <xmqqfqz2mqkx.fsf@gitster.g> (raw)
In-Reply-To: <0c82d50e-f2c0-4db6-ade8-7a403cac73da@intel.com> (Jacob Keller's message of "Sun, 20 Sep 2026 16:04:32 -0700")
Jacob Keller <jacob.e.keller@intel.com> writes:
> On 9/18/2026 12:19 AM, Haokai Ding via GitGitGadget wrote:
>> From: Haokai Ding <hk_ding@outlook.com>
>>
>> When a path is a file on one side and a directory on the other,
>> queue_diff() queues the file separately before recursing into the
>> directory. This early queue entry bypasses the reverse_diff handling
>> used for ordinary files.
>>
>> As a result, comparing directories d and e where d/sub is a file and
>> e/sub/file is another file reports both paths as deleted with -R.
>> Reversing the operands reports both paths as added instead.
>>
>> Swap the filespecs of the early queue entry when reverse_diff is set,
>> so that -R reverses the file change as well as the directory contents.
>> Add regression tests for both directions.
>>
>> Signed-off-by: Haokai Ding <hk_ding@outlook.com>
>> ---
>
> Thanks for fixing!
>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Thanks, both. Will queue.
prev parent reply other threads:[~2026-09-21 18:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 7:19 [PATCH] diff --no-index: fix -R with file/directory conflicts Haokai Ding via GitGitGadget
2026-09-20 15:23 ` René Scharfe
2026-09-20 23:04 ` Jacob Keller
2026-09-21 18:01 ` Junio C Hamano [this message]
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=xmqqfqz2mqkx.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=hk_ding@outlook.com \
--cc=jacob.e.keller@intel.com \
--cc=l.s.r@web.de \
/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