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

[PATCH v2 0/2] combine-diff: honor relative paths consistently

From
MAMuhammed Dilshad A <dilsheddilu123@gmail.com>
Date
Oct 7, 2026, 16:35 UTC
Message-ID
<cover.1791390459.git.dilsheddilu123@gmail.com>
In-Reply-To
<xmqqld89bmd1.fsf@gitster.g>
Hi Junio,

Thanks for the review. I checked the path handling and reproduced the cross-directory rename case you described.

With plain -M, the outside source is filtered before rename detection. With --follow, though, Git searches for renames with an unfiltered tree comparison, so an outside parent name can reach the combined output. The revised patch prints there/file as ../there/file when the prefix is here/. All displayed names then use the same base. The tests cover both discovery paths, including raw and NUL-separated output.

The index rejects repeated separators, but tree entry parsing does not enforce the same check. The helper now skips all separators at the prefix boundary, so it does not rely on there being only one. Explicit prefix arguments stay literal, matching ordinary diff's filtering behavior. I also wrapped the added C lines to fit the coding guidelines.

While checking the two discovery paths, I found that the fast multi-tree scan bypasses the relative-prefix filter entirely. Patch 2 fixes that separately and adds tests for outside paths and repeated separators in an explicit prefix.

Changes since v1:
* Use relative_path() for parent names outside the prefix while keeping
  ordinary diff's literal-prefix behavior for matching names.
* Preserve /dev/null, skip all boundary separators, and wrap long lines.
* Add cross-directory rename tests and the separate fast-scan fix.

The developer build with SANITIZE=leak succeeds. The affected suites pass all 77 normal tests with SHA-1 and SHA-256. A separate run with LSAN_OPTIONS=detect_leaks=1 also passes without a leak report. The existing three-parent coalescing failure in t4038 remains an expected failure.

Muhammed Dilshad A (2):
  combine-diff: honor --relative when printing paths
  combine-diff: filter the fast scan by the relative prefix
 combine-diff.c           |  70 ++++++++++++++++++---
 t/t4038-diff-combined.sh | 130 +++++++++++++++++++++++++++++++++++++++
 t/t4045-diff-relative.sh |  62 ++++++++++++++++++-
 3 files changed, 251 insertions(+), 11 deletions(-)
base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
-- 
2.55.0
Previous: Junio C HamanoNext: Muhammed Dilshad A
Message 3 of 6 in “combine-diff: honor --relative when printing paths”
  1. combine-diff: honor --relative when printing pathsMuhammed Dilshad A, Oct 7, 2026
  2. Junio C HamanoOct 7, 2026
  3. 0/2 combine-diff: honor relative paths consistentlyMuhammed Dilshad A, Oct 7, 2026
  4. 1/2 combine-diff: honor --relative when printing pathsMuhammed Dilshad A, Oct 7, 2026
  5. 2/2 combine-diff: filter the fast scan by the relative prefixMuhammed Dilshad A, Oct 7, 2026
  6. Junio C HamanoOct 7, 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.