Skip to content

Commit 7a3e761

Browse files
Fix: Check if file is modified (#201)
1 parent 8937783 commit 7a3e761

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/gitlab/actions/comment.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ end
2323
-- line in the current MR
2424
M.create_comment = function()
2525
local has_clean_tree = git.has_clean_tree()
26-
if state.settings.reviewer_settings.diffview.imply_local and not has_clean_tree then
26+
local is_modified = vim.api.nvim_buf_get_option(0, "modified")
27+
if state.settings.reviewer_settings.diffview.imply_local and (is_modified or not has_clean_tree) then
2728
u.notify(
28-
"Cannot leave comments on a dirty tree. \n Please stash all local changes or push them up.",
29+
"Cannot leave comments on changed files. \n Please stash all local changes or push them to the feature branch.",
2930
vim.log.levels.WARN
3031
)
3132
return

0 commit comments

Comments
 (0)