Skip to content

Commit 0c59927

Browse files
committed
fix: merge git status correctly to capture conflict status, fixes #255
1 parent 4db7f70 commit 0c59927

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lua/neo-tree/git/status.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ local parse_git_status_line = function(context, line)
7575
relative_path = utils.windowize_path(relative_path)
7676
end
7777
local absolute_path = utils.path_join(git_root, relative_path)
78+
-- merge status result if there are results from multiple passes
79+
local existing_status = git_status[absolute_path]
80+
if existing_status then
81+
local merged = ""
82+
local i = 0
83+
while i < 2 do
84+
i = i + 1
85+
local existing_char = #existing_status >= i and existing_status:sub(i, i) or ""
86+
local new_char = #status >= i and status:sub(i, i) or ""
87+
local merged_char = get_priority_git_status_code(existing_char, new_char)
88+
merged = merged .. merged_char
89+
end
90+
status = merged
91+
end
7892
git_status[absolute_path] = status
7993

8094
if not exclude_directories then

0 commit comments

Comments
 (0)