summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-03-07 19:31:52 -0600
committerJeff Carr <[email protected]>2024-03-07 19:31:52 -0600
commit2cdf2c3cdaffd62d28cc3e797aeba9159709dc03 (patch)
tree64303abe665f75172b40c9165e54b4dffdb2ab8b /unix.go
parentf99dc30b683e55fe87f1273febb2be42c844bd54 (diff)
working on go-clonev0.22.1
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/unix.go b/unix.go
index 6c7faef..a3b1647 100644
--- a/unix.go
+++ b/unix.go
@@ -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
+}