export isGitDir()
This commit is contained in:
parent
4d2f68606e
commit
b12bc0a9ec
|
@ -45,6 +45,11 @@ func (rs *RepoStatus) GoPath() string {
|
||||||
return rs.goPath.String()
|
return rs.goPath.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// full path
|
||||||
|
func (rs *RepoStatus) FullPath() string {
|
||||||
|
return rs.realPath.String()
|
||||||
|
}
|
||||||
|
|
||||||
func (rs *RepoStatus) IsPrimitive() bool {
|
func (rs *RepoStatus) IsPrimitive() bool {
|
||||||
if rs.primitive.String() == "true" {
|
if rs.primitive.String() == "true" {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -49,7 +49,7 @@ func ListGitDirectories() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the current path is a directory and has a .git subdirectory
|
// Check if the current path is a directory and has a .git subdirectory
|
||||||
if info.IsDir() && isGitDir(path) {
|
if info.IsDir() && IsGitDir(path) {
|
||||||
all = append(all, path)
|
all = append(all, path)
|
||||||
// fmt.Println(path)
|
// fmt.Println(path)
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ func ListGitDirectories() []string {
|
||||||
return all
|
return all
|
||||||
}
|
}
|
||||||
|
|
||||||
// isGitDir checks if a .git directory exists inside the given directory
|
// IsGitDir checks if a .git directory exists inside the given directory
|
||||||
func isGitDir(dir string) bool {
|
func IsGitDir(dir string) bool {
|
||||||
gitDir := filepath.Join(dir, ".git")
|
gitDir := filepath.Join(dir, ".git")
|
||||||
info, err := os.Stat(gitDir)
|
info, err := os.Stat(gitDir)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
|
Loading…
Reference in New Issue