summaryrefslogtreecommitdiff
path: root/doCommon.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-13 17:13:07 -0600
committerJeff Carr <[email protected]>2024-12-13 17:13:07 -0600
commit10cf50c39b19a0c023869bf2fbf27a3ec1996856 (patch)
treeaef6a224d937d0c922c119253045cd93237b6be0 /doCommon.go
parent2b090019a9149bf89f883c46786476ef8a827069 (diff)
git reset --hard optionv0.22.13
Diffstat (limited to 'doCommon.go')
-rw-r--r--doCommon.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/doCommon.go b/doCommon.go
index 296f1cb..3e94055 100644
--- a/doCommon.go
+++ b/doCommon.go
@@ -33,6 +33,25 @@ func doGitPull() {
}
}
+func doGitReset() {
+ if !argv.DoGitReset {
+ return
+ }
+ all := me.found.SortByGoPath()
+ for all.Scan() {
+ repo := all.Next()
+ if me.forge.Config.IsReadOnly(repo.GoPath) {
+ // log.Info("is readonly", repo.GoPath)
+ if repo.CheckDirty() {
+ log.Info("is readonly and dirty", repo.GoPath)
+ cmd := []string{"git", "reset", "--hard"}
+ repo.RunRealtime(cmd)
+ }
+ } else {
+ // log.Info("is not readonly", repo.GoPath)
+ }
+ }
+}
func doFix() {
all := me.found.SortByGoPath()