Skip to content

Commit 84164f7

Browse files
committed
fix(git): special case for --imply-local when both sides point to head
(fixes #491)
1 parent f17af39 commit 84164f7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/diffview/vcs/adapters/git/init.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,12 +1462,19 @@ end
14621462
---@param head Rev
14631463
---@return Rev, Rev
14641464
function GitAdapter:imply_local(left, right, head)
1465+
-- Special case when they both point to head: change only the right side in
1466+
-- order to still get a meaningful rev range.
1467+
if left.commit == head.commit and right.commit == head.commit then
1468+
return left, GitRev(RevType.LOCAL)
1469+
end
1470+
14651471
if left.commit == head.commit then
14661472
left = GitRev(RevType.LOCAL)
14671473
end
14681474
if right.commit == head.commit then
14691475
right = GitRev(RevType.LOCAL)
14701476
end
1477+
14711478
return left, right
14721479
end
14731480

0 commit comments

Comments
 (0)