From 3f6c259711252b57646f447de85e44c5239ebd0d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 18:18:47 -0300 Subject: A diff look names a file as the repository does: git's side prefix dropped by git's rules, a plain diff's names as written In a git section (one with a `diff --git` line) the one-letter side prefix git writes, `a/`/`b/` or with diff.mnemonicPrefix `c/`, `i/`, `w/`, `o/`, is dropped from its paths only when both paths of that line carry one, different ones: `--no-prefix` writes none, so its `a/x a/x` is a real directory `a` and is kept. A plain `diff -u` never strips: its names are used as written, past the timestamp. `/dev/null` stays itself. The walker does this once (diff.Walk.side, diff.gitHeader), so the path a look resolves, and the one a miss says, are the repository's name: `Look: src/x.zig: no such file here`, `Look: lib/old.zig: deleted by this diff`. The look no longer tries a stripped name beside the written one. Co-Authored-By: Claude Opus 5.5 --- docs/tags.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'docs') diff --git a/docs/tags.md b/docs/tags.md index 51977390..ec454bb8 100644 --- a/docs/tags.md +++ b/docs/tags.md @@ -97,13 +97,19 @@ opens the new file at line c. On a hunk line, the `+`, `-` or space in its first column takes the whole line and opens the new file at that line; for a removed line, at the new line now standing where it was (the one after it, or the hunk's last when it went from the end of the file). The code -after it is words, looked at as ever. Paths are the repository's: pardes -walks up from the diff's directory (a command pane's own) to a `.git` or -`.jj` and drops git's `a/`/`b/`, else takes them from that directory as -written; `diff -u`'s timestamps are cut. A file that is not here (a branch -not checked out) opens nothing and says so: `Look: b/x.zig: no such file -here`, or `deleted by this diff` for a deleted one. A 9P `look` of a whole -line of the diff does the same. +after it is words, looked at as ever. + +A path is the repository's name for the file. In a git section (one with a +`diff --git` line) git's side prefix is dropped when both paths on that +line carry one, different ones: `a/`/`b/`, or with `diff.mnemonicPrefix` +`c/`, `i/`, `w/`, `o/`. `--no-prefix` writes none, so there `a/x a/x` is a +real directory `a`, kept. A plain `diff -u`'s names are used as written, +past the timestamp. The file is looked for from the repository's root +(pardes walks up from the diff's directory, a command pane's own, to a +`.git` or `.jj`), else from that directory. A file that is not here (a +branch not checked out) opens nothing and says so by that name: `Look: +src/x.zig: no such file here`, or `deleted by this diff` for a deleted one. +A 9P `look` of a whole line of the diff does the same. ## Editing tags -- cgit v1.3