Skip to content

Commit 717b943

Browse files
committed
add BEFORE_GIT_STATUS event
1 parent 5142f02 commit 717b943

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lua/neo-tree/events/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ local M = {
1010
BEFORE_FILE_DELETE = "before_file_delete",
1111
BEFORE_FILE_MOVE = "before_file_move",
1212
BEFORE_FILE_RENAME = "before_file_rename",
13+
BEFORE_GIT_STATUS = "before_git_status",
1314
BEFORE_RENDER = "before_render",
1415
FILE_ADDED = "file_added",
1516
FILE_DELETED = "file_deleted",

lua/neo-tree/git/init.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ end
383383
local make_git_status_args = function(porcelain_version, git_root, untracked_files, ignored, paths)
384384
untracked_files = untracked_files or "normal"
385385
ignored = ignored or "traditional"
386-
local opts = {
386+
local args = {
387387
"--no-optional-locks",
388388
"-C",
389389
git_root,
@@ -392,14 +392,18 @@ local make_git_status_args = function(porcelain_version, git_root, untracked_fil
392392
"--untracked-files=" .. untracked_files,
393393
"--ignored=" .. ignored,
394394
"-z",
395-
"--",
396395
}
396+
events.fire_event(events.BEFORE_GIT_STATUS, {
397+
status_args = args,
398+
git_root = git_root,
399+
})
397400
if paths then
401+
args[#args + 1] = "--"
398402
for _, path in ipairs(paths) do
399-
opts[#opts + 1] = path
403+
args[#args + 1] = path
400404
end
401405
end
402-
return opts
406+
return args
403407
end
404408

405409
---Parse "git status" output for the current working directory.

0 commit comments

Comments
 (0)