From c1ba46b6d32c2e4310e33f739bb43db113dc2d40 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 3 Apr 2024 12:06:19 +0100 Subject: [PATCH] fix(attach): allow attaching inside .git/ Only if GIT_DIR and GIT_WORK_TREE exist in the env Fixes #923 --- lua/gitsigns/attach.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/gitsigns/attach.lua b/lua/gitsigns/attach.lua index d8e1c301..16d652e6 100644 --- a/lua/gitsigns/attach.lua +++ b/lua/gitsigns/attach.lua @@ -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