git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff --no-index: fix -R with file/directory conflicts

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 21, 2026, 18:01 UTC
Message-ID
<xmqqfqz2mqkx.fsf@gitster.g>
In-Reply-To
<0c82d50e-f2c0-4db6-ade8-7a403cac73da@intel.com>
Jacob Keller <jacob.e.keller@intel.com> writes:
Show 22 quoted lines
> 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.
Previous: Jacob Keller
Message 4 of 4 in “diff --no-index: fix -R with file/directory conflicts”
  1. diff --no-index: fix -R with file/directory conflictsHaokai Ding via GitGitGadget, Sep 18, 2026
  2. René ScharfeSep 20, 2026
  3. Jacob KellerSep 20, 2026
  4. Junio C HamanoSep 21, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.