Skip to content

Commit

Permalink
fix(project_diff_screen): notify users once all conflicts are resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
tanvirtin committed Jun 14, 2024
1 parent 2924520 commit 7c65505
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/vgit/features/screens/ProjectDiffScreen/Store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ function Store:set_list_folds(list_folds)
self.state.list_folds = list_folds
end

function Store:conflict_status()
local reponame = git_repo.discover()
return git_conflict.status(reponame)
end

function Store:get_file_lines(status, type)
local filename = status.filename
local reponame = git_repo.discover()
Expand Down Expand Up @@ -169,7 +174,7 @@ function Store:get_file_hunks(status, type, lines)
local head_log, head_log_err = git_log.get(reponame, 'HEAD')
if head_log_err then return nil, head_log_err end
if not head_log then return nil, { 'failed to find head log' } end
local conflict_type, conflict_type_err = git_conflict.status(reponame)
local conflict_type, conflict_type_err = self:conflict_status()
if conflict_type_err then return nil, conflict_type_err end
local merge_log, merge_log_err = git_log.get(reponame, conflict_type)
if not merge_log then return nil, { 'failed to find merge log' } end
Expand Down
4 changes: 4 additions & 0 deletions lua/vgit/features/screens/ProjectDiffScreen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ function ProjectDiffScreen:show()
end

if utils.object.is_empty(data) then
if self.store:conflict_status() then
console.info('All conflicts fixed but you are still merging')
return false
end
console.info('No changes found')
return false
end
Expand Down

0 comments on commit 7c65505

Please sign in to comment.