From fab3dc1d945aacd8516e7586c76e50c22248f905 Mon Sep 17 00:00:00 2001 From: Job79 Date: Sun, 8 Nov 2026 11:40:37 +0100 Subject: [PATCH] chore: default :Review to unpushed commits Co-Authored-By: Claude Opus 5.5 --- lua/git.lua | 4 ++-- plugin/30_commands.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/git.lua b/lua/git.lua index fe3b162..e4caff6 100644 --- a/lua/git.lua +++ b/lua/git.lua @@ -62,10 +62,10 @@ end -- Last review, refreshed by `review()` without args local last = {} --- Review changes since the merge-base with `base` (default origin/HEAD) up to `head`. +-- Review changes since the merge-base with `base` (default @{upstream}, i.e. unpushed commits) up to `head`. -- Without `head` the working tree is used, so the right side is your real, editable file. local function review(base, head) - if base or not last.base then last = { base = base or 'origin/HEAD', head = head, seen = {} } end + if base or not last.base then last = { base = base or '@{upstream}', head = head, seen = {} } end local root = vim.trim(git({ 'rev-parse', '--show-toplevel' })) local merge_base = vim.trim(git({ 'merge-base', last.base, last.head or 'HEAD' })) local range = last.head and (merge_base .. '..' .. last.head) or merge_base diff --git a/plugin/30_commands.lua b/plugin/30_commands.lua index 1f42af8..da6cc54 100644 --- a/plugin/30_commands.lua +++ b/plugin/30_commands.lua @@ -1,5 +1,5 @@ -- :Review [base] [head] e.g. `:Review origin/develop`, `:Review origin/main origin/feat-x` --- Without args it refreshes the last review (or starts one against origin/HEAD) +-- Without args it refreshes the last review (or starts one against @{upstream}: unpushed commits) Config.command('Review', function(o) require('git').review(o.fargs[1], o.fargs[2]) end, 'Review changes against merge-base', { nargs = '*', complete = function() return vim.fn.systemlist('git branch -a --format=%(refname:short)') end,