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

[PATCH 1/2] diff-lib: drop stale comment about advancing o->pos

From
Jeff King <peff@peff.net>
Date
Jul 26, 2026, 08:46 UTC
Message-ID
<20260726084622.GA3529698@coredump.intra.peff.net>
In-Reply-To
<20260726084550.GC2366012@coredump.intra.peff.net>

The comment above oneway_diff() claims that the callback must advance o->pos to skip index entries it has already processed. That stopped being true in da165f470e (unpack-trees.c: prepare for looking ahead in the index, 2010-01-07), which moved that bookkeeping into unpack_trees().

Signed-off-by: Jeff King <peff@peff.net>
---
 diff-lib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/diff-lib.c b/diff-lib.c
index a23119b852..95f920a9a0 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -508,11 +508,9 @@ static void do_oneway_diff(struct unpack_trees_options *o,
  * For diffing, the index is more important, and we only have a
  * single tree.
  *
- * We're supposed to advance o->pos to skip what we have already processed.
- *
  * This wrapper makes it all more readable, and takes care of all
  * the fairly complex unpack_trees() semantic requirements, including
- * the skipping, the path matching, the type conflict cases etc.
+ * the path matching, the type conflict cases etc.
  */
 static int oneway_diff(const struct cache_entry * const *src,
 		       struct unpack_trees_options *o)
-- 
2.55.0.742.gf2bff09aa6
Previous: Jeff KingNext: Jeff King
Message 4 of 12 in “diff: ignore unmerged paths outside prefix with --relative --cached”
  1. diff: ignore unmerged paths outside prefix with --relative --cachedJeff King, Jul 15, 2026
  2. Junio C HamanoJul 15, 2026
  3. 0/2 diff-lib relative-path cleanupsJeff King, Jul 26, 2026
  4. 1/2 diff-lib: drop stale comment about advancing o->posJeff King, Jul 26, 2026
  5. 2/2 diff-lib: skip paths outside prefix in oneway_diff()Jeff King, Jul 26, 2026
  6. Jeff KingJul 27, 2026
  7. Junio C HamanoJul 28, 2026
  8. diff-lib: add idx/tree sanity check to oneway_diffJeff King, Jul 28, 2026
  9. Junio C HamanoJul 28, 2026
  10. Jeff KingJul 28, 2026
  11. Junio C HamanoJul 26, 2026
  12. Junio C HamanoJul 24, 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.