diff options
Diffstat (limited to 'core/hunks.zig')
| -rw-r--r-- | core/hunks.zig | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/hunks.zig b/core/hunks.zig index d8c5e2de..8f56f8f1 100644 --- a/core/hunks.zig +++ b/core/hunks.zig @@ -705,7 +705,9 @@ fn trimmedWidth(ctx: *const Ctx, section: []const u8) usize { /// change (`Diff wrnnmymq [path[:line]]`: jj.diffChange), its patch, header /// and all, the cursor at that place in it; with two points joined by `..` /// (`Diff ozlwptts..pyquzokk [path[:line]]`: jj.diffPair), the difference -/// between them, the changes between on top. A plumbing +/// between them, the changes between on top; with any other word that names +/// no file, in a jj repository, the revision jj takes it for (`Diff @-`, a +/// bookmark), its patch as a change's. A plumbing /// rule's Diff that cannot (no hunk, no work tree) declines, saying /// nothing (Pardes.plumb_declined), and the look looks itself. pub fn word(c: pardes.builtins.Ctx) void { @@ -738,12 +740,15 @@ pub fn word(c: pardes.builtins.Ctx) void { // A jj change (its letters k to z), with a place in its patch to stand at; // two points joined by `..`, a `Compare`'s pair. if (@import("jj.zig").diffPair(p, c.id, arg)) return; - if (@import("jj.zig").diffChange(p, c.id, arg)) return; + if (@import("jj.zig").diffChange(p, c.id, arg, false)) return; if (@import("jj.zig").isChangeId(arg[0 .. std.mem.indexOfAny(u8, arg, " \t") orelse arg.len])) return declined(p, c.id, "Diff: no such change"); var buf: [4096]u8 = undefined; const path = if (arg[0] == '/') arg else std.fmt.bufPrint(&buf, "{s}/{s}", .{ std.mem.trimEnd(u8, Pardes.paneDir(c.pane), "/"), arg }) catch arg; const bytes = pardes.filesystem.read(p, path) catch |err| { if (p.plumb_declined != null) return declined(p, c.id, ""); + // No such file: a revision jj takes (`Diff @-`, a bookmark), its + // patch with its header, as a change's. + if (err == error.FileNotFound and @import("jj.zig").diffChange(p, c.id, arg, true)) return; return p.reportError(.at(c.id), path, err); }; defer p.gpa.free(bytes); |
