chore: default :Review to unpushed commits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2 files changed
+3
-3
No files matched your search
+2
-2
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user