summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-10 05:50:11 -0500
committerJeff Carr <[email protected]>2025-10-10 05:50:11 -0500
commitb95b8bf55b6598d27a143e43d2353737e5bbc1b1 (patch)
tree2b2d9b11b4141717d673b138c3da63682a60b53e
parent56869600e6d62729962699526807714124d46973 (diff)
an edge case to handle when you are on a branch that doesn't exist
-rw-r--r--argv.go16
-rw-r--r--doFix.go25
-rw-r--r--doShow.go19
3 files changed, 29 insertions, 31 deletions
diff --git a/argv.go b/argv.go
index 290402a..952d79d 100644
--- a/argv.go
+++ b/argv.go
@@ -54,17 +54,17 @@ type EmptyCmd struct {
type testCmd string
type ShowCmd struct {
- Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
- Porcelain *EmptyCmd `arg:"subcommand:porcelain" help:"git status --porcelain"`
- 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"`
+ 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 {
- 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)"`
- Prune bool `arg:"--prune" help:"'git fetch --prune' everywhere"`
+ 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)"`
+ Prune bool `arg:"--prune" help:"'git fetch --prune' everywhere"`
}
func (ShowCmd) Examples() string {
diff --git a/doFix.go b/doFix.go
index f29aa04..df9b861 100644
--- a/doFix.go
+++ b/doFix.go
@@ -12,9 +12,10 @@ import (
// is every repo on the devel branch?
func doFix() (string, error) {
+ var s string
+ var err error
if argv.Fixer.Urls {
- err := doFixUrls()
- return "", err
+ err = doFixUrls()
}
if argv.Fixer.Untracked {
return doRemoveUntrackedFiles()
@@ -31,9 +32,25 @@ func doFix() (string, error) {
}
repo.RunVerbose([]string{"git", "fetch", "--prune"})
}
- return "", nil
}
- return "", nil
+
+ if argv.Fixer.Porcelain != nil {
+ s, err = getPorcelain()
+ for repo := range me.forge.Repos.IterByFullPath() {
+ curbranch := repo.GetCurrentBranchName()
+ if repo.IsLocalBranch(curbranch) {
+ continue
+ }
+ if repo.IsRemoteBranch(curbranch) {
+ continue
+ }
+ log.Info("curbranch is doesn't exist. this'll cause all sorts of problems", curbranch, repo.FullPath)
+ repo.CheckoutForce()
+ }
+ me.forge.Repos.Save()
+ }
+
+ return s, err
}
func doRemoveUntrackedFiles() (string, error) {
diff --git a/doShow.go b/doShow.go
index f114033..0b53cb3 100644
--- a/doShow.go
+++ b/doShow.go
@@ -3,8 +3,6 @@
package main
-import "go.wit.com/log"
-
// An app to submit patches for the 30 GO GUI repos
func doShow() (string, error) {
@@ -15,23 +13,6 @@ func doShow() (string, error) {
return s, err
}
- if argv.Show.Porcelain != nil {
- s, err := getPorcelain()
- for repo := range me.forge.Repos.IterByFullPath() {
- curbranch := repo.GetCurrentBranchName()
- if repo.IsLocalBranch(curbranch) {
- continue
- }
- if repo.IsRemoteBranch(curbranch) {
- continue
- }
- log.Info("curbranch is doesn't exist. this'll cause all sorts of problems", curbranch, repo.FullPath)
- repo.CheckoutForce()
- }
- me.forge.Repos.Save()
- return s, err
- }
-
if argv.Show.Tag != nil {
doTag()
return "tags shown", nil