Skip to content

Commit

Permalink
bugfix in collection of repository directories
Browse files Browse the repository at this point in the history
  • Loading branch information
galan committed Jun 3, 2021
1 parent ba395d4 commit 2829229
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions internal/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ func validateArgGitDir(argIndex int, repoParent bool, repoRoot bool) cobra.Posit
// collect all directories that contain .git
func collectGitDirs(dir string, provider hoster.Hoster) (result []model.RepoDir, err error) {
dirAbs, _ := filepath.Abs(dir)
if util.ExistsDir(path.Join(dirAbs, ".git")) {
// check if given path is git-repository
if util.ExistsDir(path.Join(dirAbs, ".git")) { // check if given path is git-repository
repo, err := model.MakeRepoDir(dirAbs, provider.Host())
if err != nil {
say.Verbose("Failed determine repository directory: %s", err)
return result, err
}
result = append(result, *repo)
} else {
// else search for all sub-dir git-repositories
} else { // else search for all sub-dir git-repositories
dirs, err := ioutil.ReadDir(dirAbs)
if err != nil {
return result, err
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/util/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func ExistsFile(filename string) bool {
// checks if the directory exists and is not a file
func ExistsDir(dirPath string) bool {
info, err := os.Stat(dirPath)
if os.IsNotExist(err) {
if os.IsNotExist(err) || err != nil { // err.data=ENOTDIR on file
return false
}
return info.IsDir()
Expand Down

0 comments on commit 2829229

Please sign in to comment.