summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-08 01:25:59 -0500
committerJeff Carr <[email protected]>2025-10-08 01:25:59 -0500
commit2051819a243831280435715ddeeb1c15f069032a (patch)
tree432d48cd1c9a4ca0e69d23586e783f0ddc515513
parent22cce80e37500aca072a6e2a6de8900b67a74086 (diff)
find files git says are safe to deletev0.0.155
-rw-r--r--repo.common.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/repo.common.go b/repo.common.go
index 9e1233d..bf80f81 100644
--- a/repo.common.go
+++ b/repo.common.go
@@ -4,6 +4,7 @@ import (
"errors"
"os"
"path/filepath"
+ "sort"
"strings"
"go.wit.com/log"
@@ -140,3 +141,27 @@ func (repo *Repo) GetProtoFiles() ([]string, error) {
return protofiles, err
}
+
+func (pb *Repos) ActualSort() {
+ repoMu.RLock()
+ defer repoMu.RUnlock()
+ sort.Sort(sortRepoNamespace(pb.Repos))
+}
+
+// returns the list of files that can be deleted
+// show untracked files
+// git ls-files --others
+// git ls-files --others --exclude-standard
+// git ls-files --others --ignored --exclude-standard
+func (repo *Repo) GitDeleteOthers() ([]string, error) {
+ var filelist []string
+ var err error
+ r, err := repo.RunQuiet([]string{"git", "ls-files", "--others"})
+ if err != nil {
+ return nil, err
+ }
+ for _, fname := range r.Stdout {
+ filelist = append(filelist, filepath.Join(repo.FullPath, fname))
+ }
+ return filelist, nil
+}