summaryrefslogtreecommitdiff
path: root/gitCheckout.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-07 21:22:54 -0600
committerJeff Carr <[email protected]>2025-01-07 21:22:54 -0600
commite6e70ccaa50a73e571e3251010e06847ad232829 (patch)
treea83c7013d9ef6daf429da1845d97878444c1b78b /gitCheckout.go
parent67ae8d8773e97cc93f4a3fc400e77b67dd554ceb (diff)
add a way to force git checkout anyway
Diffstat (limited to 'gitCheckout.go')
-rw-r--r--gitCheckout.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/gitCheckout.go b/gitCheckout.go
index a3c60a0..135dfaf 100644
--- a/gitCheckout.go
+++ b/gitCheckout.go
@@ -140,6 +140,28 @@ func (f *Forge) CheckoutUser() bool {
for all.Scan() {
repo := all.Next()
count += 1
+ if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
+ // already on the user branch
+ continue
+ }
+ if repo.CheckoutUser() {
+ // checkout ok
+ } else {
+ failed += 1
+ }
+ }
+ log.Log(FORGEPBWARN, "Ran git checkout in", count, "repos. failure count =", failed)
+ return true
+}
+
+func (f *Forge) CheckoutUserForce() bool {
+ log.Log(FORGEPBWARN, "running git checkout user everwhere")
+ var failed int = 0
+ var count int = 0
+ all := f.Repos.SortByFullPath()
+ for all.Scan() {
+ repo := all.Next()
+ count += 1
if repo.CheckoutUser() {
// checkout ok
} else {