INNER CODE UNIT · Go

findPathToFirstParentGitRepo

bliporg/blip · deps/deptool/cmd/main.go:190

func findPathToFirstParentGitRepo() (string, error) {
	limit := 20

	// get current working directory
	dir, err := os.Getwd()
	if err != nil {
		return "", err
	}

	// Find the first parent directory that is a git repository
	// fmt.Println("🔍 searching for git repo in:", dir)
	for dir != "." {
		if _, err := os.Stat(filepath.Join(dir, ".git")); err == nil {
			return dir, nil
		}
		dir = filepath.Dir(dir)
		limit--
		if limit <= 0 {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…