From 06cf0f7d844192eacbaeec60e3cc12c9a7968469 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 4 Apr 2025 06:07:56 -0500 Subject: [PATCH] fix defective google "Git on Borg" repos --- argv.go | 1 + argvAutoshell.go | 2 +- doCheckout.go | 16 ++++++++++++---- main.go | 6 +++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/argv.go b/argv.go index ac60597..aeae447 100644 --- a/argv.go +++ b/argv.go @@ -101,6 +101,7 @@ type FindCmd struct { Private bool `arg:"--private" help:"your private repos from your .config/forge/"` Dirty bool `arg:"--dirty" help:"only use dirty git repos"` User bool `arg:"--user" help:"show repos on the user branch"` + Full bool `arg:"--full" help:"show full repo names"` // ReadOnly bool `arg:"--readonly" help:"include read-only repos"` } diff --git a/argvAutoshell.go b/argvAutoshell.go index fd76d45..3b8c98d 100644 --- a/argvAutoshell.go +++ b/argvAutoshell.go @@ -42,7 +42,7 @@ func (args) doBashAuto() { case "examine": fmt.Println("fix") case "list": - fmt.Println("--all --mine --favorites --private") + fmt.Println("--full") case "pull": fmt.Println("--force") case "patch": diff --git a/doCheckout.go b/doCheckout.go index 8621cc9..fcf095b 100644 --- a/doCheckout.go +++ b/doCheckout.go @@ -5,6 +5,7 @@ package main import ( "fmt" + "os" "path/filepath" "time" @@ -191,12 +192,19 @@ func rillCheckoutMaster(repo *gitpb.Repo) error { // never do dirty repos return nil } - if repo.GetCurrentBranchName() == repo.GetMasterBranchName() { - // repo is already on master + // 'giterr' means something is very wrong with this repo + if repo.GetMasterVersion() == "giterr" { + repo.CheckoutMaster() + log.Info("master == giterr. BAD REPO", repo.GetFullPath()) + log.Info("master == giterr. BAD REPO", repo.GetFullPath()) + log.Info("master == giterr. BAD REPO", repo.GetFullPath()) + cmd := []string{"git", "checkout", "main"} // todo: figure out main + repo.RunVerbose(cmd) + os.Exit(-1) return nil } - if repo.GetUserVersion() == "uerr" { - repo.CheckoutMaster() + if repo.GetCurrentBranchName() == repo.GetMasterBranchName() { + // repo is already on master return nil } if me.forge.Config.IsReadOnly(repo.GetGoPath()) { diff --git a/main.go b/main.go index 03bfc56..6e63f12 100644 --- a/main.go +++ b/main.go @@ -142,7 +142,11 @@ func main() { if argv.List != nil { found := argv.List.findRepos() // print out the repos - me.forge.PrintHumanTable(found) + if argv.List.Full { + me.forge.PrintHumanTableFull(found) + } else { + me.forge.PrintHumanTable(found) + } okExit("") }