diff options
| author | Jeff Carr <[email protected]> | 2024-03-07 19:31:52 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-03-07 19:31:52 -0600 |
| commit | 2cdf2c3cdaffd62d28cc3e797aeba9159709dc03 (patch) | |
| tree | 64303abe665f75172b40c9165e54b4dffdb2ab8b /unix.go | |
| parent | f99dc30b683e55fe87f1273febb2be42c844bd54 (diff) | |
working on go-clonev0.22.1
Diffstat (limited to 'unix.go')
| -rw-r--r-- | unix.go | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -449,3 +449,26 @@ func (rs *RepoStatus) DoAll(all [][]string) bool { } return true } + +func ScanGitDirectories(srcDir string) []string { + var all []string + err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + log.Log(REPOWARN, "Error accessing path:", path, err) + return nil + } + + // Check if the path is a directory and has a .git subdirectory + if info.IsDir() && IsGitDir(path) { + all = append(all, path) + } + + return nil + }) + + if err != nil { + log.Log(REPOWARN, "Error walking the path:", srcDir, err) + } + + return all +} |
