Skip to content

Commit

Permalink
fix(attach): allow attaching inside .git/
Browse files Browse the repository at this point in the history
Only if GIT_DIR and GIT_WORK_TREE exist in the env

Fixes #923
  • Loading branch information
lewis6991 committed May 1, 2024
1 parent f65d1d8 commit 7a87f3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/gitsigns/attach.lua
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ local attach_throttled = throttle_by_id(function(cbuf, ctx, aucmd)
gitdir = git_obj.repo.gitdir,
})

if vim.startswith(file, git_obj.repo.gitdir .. util.path_sep) then
if
vim.startswith(file, git_obj.repo.gitdir .. util.path_sep)
and not vim.env.GIT_DIR
and not vim.env.GIT_WORK_TREE
then
dprint('In non-standard git dir')
return
end
Expand Down

0 comments on commit 7a87f3e

Please sign in to comment.