From bfeb39c2504eec32091a09b5b8ffe04004f67655 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 10 Oct 2025 09:34:31 -0500 Subject: allow show to do default master behavior --- argv.go | 40 +++++++++++++++++++++------------------- doShow.go | 8 ++++++++ find.go | 1 + 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/argv.go b/argv.go index b044d0f..90e1b3a 100644 --- a/argv.go +++ b/argv.go @@ -35,34 +35,22 @@ type args struct { Fix bool `arg:"--fix" help:"try to make repairs"` } -func (args) Examples() string { - var out string - out += "forge show # show the state of all your repos\n" - out += "forge normal # the defaults for 'normal' forge distributed development\n" - out += " # it will makes a user branch in every git repo\n" - out += "forge clean # removes changes forge might have made\n" - out += " # purges all untracked git files, etc\n" - out += "forge pull --force # 'git pull' on all repos\n" - out += "forge merge --all # merge all patches to devel & master\n" - out += "forge add # scan your current directory for all git repos\n" - return out -} - type EmptyCmd struct { } type testCmd string type ShowCmd struct { - Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"` - DirtySave *EmptyCmd `arg:"subcommand:dirtysave" help:"check dirty then save"` - Mtime *EmptyCmd `arg:"subcommand:mtime" help:"show mtime changes"` - Repo *RepoCmd `arg:"subcommand:repos" help:"print a table of the current repos"` - Tag *TagCmd `arg:"subcommand:tag" help:"show git tags"` + Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"` + DirtySave *EmptyCmd `arg:"subcommand:dirtysave" help:"check dirty then save"` + MasterDefault *EmptyCmd `arg:"subcommand:masterdefault" help:"run the default behavior for master branches"` + Mtime *EmptyCmd `arg:"subcommand:mtime" help:"show mtime changes"` + Repo *RepoCmd `arg:"subcommand:repos" help:"print a table of the current repos"` + Tag *TagCmd `arg:"subcommand:tag" help:"show git tags"` } type FixCmd struct { - Porcelain *EmptyCmd `arg:"subcommand:porcelain" help:"git status --porcelain"` + Porcelain *EmptyCmd `arg:"subcommand:porcelain" help:"git status --porcelain"` Urls bool `arg:"--urls" help:"check for changes in repo urls"` Untracked bool `arg:"--untracked" help:"git untracked file list"` DeleteUser bool `arg:"--delete-user" help:"delete all user branches (checks for safety)"` @@ -207,6 +195,20 @@ func (args) Appname() string { return ARGNAME } +func (args) Examples() string { + var out string + out += "forge show # show the state of all your repos\n" + out += "forge normal # the defaults for 'normal' forge distributed development\n" + out += " # it will makes a user branch in every git repo\n" + out += "forge clean # removes changes forge might have made\n" + out += " # purges all untracked git files, etc\n" + out += "forge pull --force # 'git pull' on all repos\n" + out += "forge commit --al # 'git commit' in every dirty repo\n" + out += "forge merge --all # 'git merge' all patches to devel & master\n" + out += "forge add # scan your current directory for all git repos\n" + return out +} + func (a args) DoAutoComplete(pb *prep.Auto) { if pb.Cmd == "" { pb.Autocomplete3([]string{"checkout", "clean", "commit", "gui", "merge", "mode", "patch", "pull", "show", "add", "fixer", "--version", "--force", "dev", "normal"}) diff --git a/doShow.go b/doShow.go index 30d6f58..5f4025f 100644 --- a/doShow.go +++ b/doShow.go @@ -26,6 +26,14 @@ func doShow() (string, error) { return s, err } + if argv.Show.MasterDefault != nil { + err := defaultBehaviorMaster() + if err != nil { + return "has problems", err + } + return "default master behavior is ok", nil + } + found := findRepos() if showUrls() { found.SortNamespace() diff --git a/find.go b/find.go index 6963901..6ff3d00 100644 --- a/find.go +++ b/find.go @@ -267,6 +267,7 @@ func cloneReposWithPatches() *gitpb.Repos { // this is an old test to see if the current 'last tag' is accurate and should be removed if repo.GetLastTag() != repo.GetMasterVersion() { + repo.ReloadForce() r := found.Clone(repo) r.FindLastTag() r.State = "lasttag mismatch" -- cgit v1.2.3