MCPcopy Create free account
hub / github.com/git-bug/git-bug / isGitDir

Function isGitDir

repository/gogit.go:229–246  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

227}
228
229func isGitDir(path string) (bool, error) {
230 markers := []string{"HEAD", "objects", "refs"}
231
232 for _, marker := range markers {
233 _, err := os.Stat(filepath.Join(path, marker))
234 if err == nil {
235 continue
236 }
237 if !os.IsNotExist(err) {
238 // unknown error
239 return false, err
240 } else {
241 return false, nil
242 }
243 }
244
245 return true, nil
246}
247
248func (repo *GoGitRepo) Close() error {
249 var firstErr error

Callers 1

detectGitPathFunction · 0.85

Calls 1

StatMethod · 0.45

Tested by

no test coverage detected