Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

recursively search parent directory for vcs directory #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ import (
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
)

func repoDirExists(projPath, repoDir string) bool {
path := filepath.Join(projPath, repoDir)
info, err := os.Stat(path)
if err != nil {
return false
for ; projPath != path.Dir(projPath); projPath = path.Dir(projPath) {
path := filepath.Join(projPath, repoDir)
info, err := os.Stat(path)
if err != nil {
continue
}
if info.IsDir() {
return true
}
}
return info.IsDir()
return false
}

// getId gets first line of commands output which should hold some VCS
Expand Down