diff options
| author | Jeff Carr <[email protected]> | 2025-10-06 07:05:43 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-06 07:05:43 -0500 |
| commit | fcd790a46c0fa6991e08dc825d10b5a13276bbe5 (patch) | |
| tree | feb23c82d123d6635acd33bd31de1c0b26efcc0e /doDev.go | |
| parent | 8516f60136ead0156cf1f6d2784206bb584a5d82 (diff) | |
make something to purge untracked files
Diffstat (limited to 'doDev.go')
| -rw-r--r-- | doDev.go | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -6,6 +6,7 @@ package main import ( "errors" "fmt" + "path/filepath" "strings" "go.wit.com/lib/protobuf/forgepb" @@ -18,6 +19,47 @@ var ErrorNeedArgvFix error = errors.New("add --fix") // FORGE USES THESE TO RECOVER FROM WHEN TOOLKITS FAIL TO LOAD // so don't delete them func doDev() (string, error) { + if argv.Dev.Untracked { + // show untracked files + // git ls-files --others + // git ls-files --others --exclude-standard + // git ls-files --others --ignored --exclude-standard + var count int + var filelist []string + found := gitpb.NewRepos() + for repo := range me.forge.Repos.IterByNamespace() { + var err error + r, err := repo.RunQuiet([]string{"git", "ls-files", "--others"}) + if err != nil { + continue + } + if len(r.Stdout) == 0 { + continue + } + count += len(r.Stdout) + for _, fname := range r.Stdout { + filelist = append(filelist, filepath.Join(repo.FullPath, fname)) + } + repo.State = log.Sprintf("%d files", len(r.Stdout)) + found.Append(repo) + } + me.forge.PrintHumanTable(found) + log.Info("") + log.Info("You have %d files that are untracked excluded git files. They are probably junk.", count) + log.Info("") + log.Info("You can remove these files with '--fix' or list them all with '--verbose'") + log.Info("") + if argv.Fix { + log.Info("todo: unlink them") + } + if argv.Verbose { + for _, fname := range filelist { + log.Info(fname) + } + } + return "", nil + + } if argv.Dev.Prune { // git fetch --prune for repo := range me.forge.Repos.IterByNamespace() { |
