diff options
| author | Jeff Carr <[email protected]> | 2025-01-05 01:18:47 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-05 01:18:47 -0600 |
| commit | 18ee541f89be2e9f9a91c54873da87885e8ffdf5 (patch) | |
| tree | 3abf86866276cf4ebe1775ab7c0f10d129cf7524 /findRepos.go | |
| parent | c25a7ea736aa4848de7eb6a5efe6124a87c39deb (diff) | |
'forge dirty' will find and list only dirty repos
Diffstat (limited to 'findRepos.go')
| -rw-r--r-- | findRepos.go | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/findRepos.go b/findRepos.go index a55c2c3..03705a7 100644 --- a/findRepos.go +++ b/findRepos.go @@ -1,6 +1,16 @@ package main -// by default, work against every repo +import ( + "go.wit.com/lib/protobuf/gitpb" +) + +// this populates a slice of protobuf records representing each git repo +// var me.found []*gitpb.Repo +// +// so, it makes a subset of repos that are then used performing actions on +// +// by default, it adds every repo + func (f *FindCmd) findRepos() { if f == nil { findMine() @@ -8,7 +18,7 @@ func (f *FindCmd) findRepos() { } if f.All { - findAll(f) + findAll() return } @@ -21,21 +31,28 @@ func (f *FindCmd) findRepos() { findMine() return } + if f.Favorites { findFavorites() return } - findAll(f) + if f.Dirty { + findDirty() + return + } + + findAll() } +/* func findRepos(fargv *FindCmd) { if fargv == nil { findMine() return } if fargv.All { - findAll(fargv) + findAll() return } @@ -55,6 +72,7 @@ func findRepos(fargv *FindCmd) { findMine() } +*/ func findPrivate() { all := me.forge.Repos.SortByFullPath() @@ -78,7 +96,7 @@ func findMine() { } } -// finds repos that are writable +// finds repos the user has marked as favorites in the forge .config func findFavorites() { // log.Printf("get favorites %s\n", me.forge.GetGoSrc()) all := me.forge.Repos.SortByFullPath() @@ -90,7 +108,19 @@ func findFavorites() { } } -func findAll(fargv *FindCmd) { +// finds repos that git is reporting as dirty +func findDirty() { + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + var repo *gitpb.Repo + repo = all.Next() + if repo.IsDirty() { + me.found.AppendUniqueGoPath(repo) + } + } +} + +func findAll() { all := me.forge.Repos.SortByFullPath() for all.Scan() { repo := all.Next() |
