summaryrefslogtreecommitdiff
path: root/doPatch.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-07 12:05:36 -0500
committerJeff Carr <[email protected]>2025-09-07 12:05:36 -0500
commitdb758bbed22ad2542e80f927a2d27f5be19ddd5b (patch)
tree95ef2269d785247d26a21e1bbff29755ebc87b7c /doPatch.go
parent3df2601f274645fd9db9b791aa76b62b5f3b6f3a (diff)
work on "forge pull"
Diffstat (limited to 'doPatch.go')
-rw-r--r--doPatch.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/doPatch.go b/doPatch.go
index d80723c..4e456f1 100644
--- a/doPatch.go
+++ b/doPatch.go
@@ -27,10 +27,21 @@ func doPatchInit() {
}
}
+func isPatchingSafe() bool {
+ if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
+ return true
+ }
+ log.Info("forge requres a 'normal' state to work with patches")
+ log.Info("you must run:")
+ log.Info("")
+ log.Info("forge normal")
+ log.Info("")
+ return false
+}
+
func doPatch() error {
- if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
- log.Info("forge requres a 'normal' state to work with patches")
- return log.Errorf("not in 'normal' forge state")
+ if !isPatchingSafe() {
+ return log.Errorf("not safe to work on patches")
}
if argv.Patch.Submit != nil {
@@ -194,12 +205,12 @@ func IsValidPatch(p *forgepb.Patch) bool {
log.Info("can not apply patch! repo not found", basepath, filename)
return false
}
- if repo.DevelHash() != p.StartHash {
+ if repo.ActualDevelHash() != p.StartHash {
log.Info("can not apply patch! devel hash mismatch", basepath, filename)
return false
}
- if repo.DevelHash() == p.StartHash {
- log.Info("local devel hash:", repo.DevelHash(), "matches patch hash", p.StartHash, "and can be applied")
+ if repo.ActualDevelHash() == p.StartHash {
+ log.Info("local devel hash:", repo.ActualDevelHash(), "matches patch hash", p.StartHash, "and can be applied")
}
log.Info("start:", p.StartHash, "end:", p.CommitHash, "file:", basepath, filename, "devel version", repo.GetDevelVersion())
for _, line := range p.Files {