Skip to content

Commit ba6b9e6

Browse files
committed
Refactor how we detect git repo
1 parent e19934f commit ba6b9e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/ruby_lsp/tapioca/addon.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
end
1414

1515
require "zlib"
16+
require "open3"
1617

1718
module RubyLsp
1819
module Tapioca
@@ -133,9 +134,11 @@ def file_updated?(change, path)
133134
false
134135
end
135136

136-
sig { returns(T::Boolean) }
137+
sig { returns(T.nilable(T::Boolean)) }
137138
def git_repo?
138-
Dir.exist?(".git")
139+
_, status = Open3.capture2e("git rev-parse --is-inside-work-tree")
140+
141+
status.success?
139142
end
140143

141144
sig { returns(T::Boolean) }

0 commit comments

Comments
 (0)