feat: support custom $GIT_DIR (#2263)
* feat: Watch $GIT_DIR for git changes, if set While rarely used, it's possible to set the $GIT_DIR environment variable to instruct git to use a directory other than `.git`. This checks if that environment variable is set; if it is, the plugin will watch that directory. If it's not set, it'll fall back to the default `.git` directory. * fix: Don't create two watchers for $GIT_DIR This will ignore a path for watching if EITHER it's '.git', or the value of $GIT_DIR (if it's set). If $GIT_DIR is not set, the vim.env object returns `nil`, which will never match `path`. * fix: Attempt to make a relative $GIT_DIR absolute
This commit is contained in:
@@ -186,7 +186,8 @@ function M.load_project_status(cwd)
|
||||
end)
|
||||
end
|
||||
|
||||
watcher = Watcher:new(utils.path_join { project_root, ".git" }, WATCHED_FILES, callback, {
|
||||
local git_dir = vim.env.GIT_DIR or utils.path_join { project_root, ".git" }
|
||||
watcher = Watcher:new(git_dir, WATCHED_FILES, callback, {
|
||||
project_root = project_root,
|
||||
})
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user