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 Apr 3, 2024
1 parent 0994d89 commit c1ba46b
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 @@ -314,7 +314,11 @@ local attach_throttled = throttle_by_id(function(cbuf, ctx, aucmd)
gitdir = repo.gitdir,
})

if vim.startswith(file, repo.gitdir .. util.path_sep) then
if
vim.startswith(file, 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 c1ba46b

Please sign in to comment.