return
}
-func (r *Recipe) MakePatches(prefix string, sync bool) (err error) {
- count := 0
+func (r *Recipe) MakePatches(prefix string, sync bool) (count int, err error) {
branch, baseline := r.branchName(prefix)
// rm -rf /tmp/xsa
makePatches := func(tree Tree) (err error) {
xr := G.repos.XenRepos[tree]
- if !xr.VerifyRef(branch) {
+ branchHash, err := xr.ParseRef(branch)
+ if err != nil {
+ return err
+ }
+
+ baseHash, err := xr.ParseRef(baseline)
+ if err != nil {
+ return err
+ }
+
+ if branchHash == "" {
return
}
- if !xr.VerifyRef(baseline) {
+ if baseHash == "" {
fmt.Printf("WARNING: Repo %s has branch %s but no branch %s, skipping\n",
tree, branch, baseline)
return
}
+ if branchHash == baseHash {
+ fmt.Printf("base and branch are identical, skipping\n")
+ return
+ }
+
count++
path := FPPath + "/" + tree.String()
}
if count == 0 {
- err = fmt.Errorf("No patches created")
return
}
return 1
}
- if err := r.MakePatches("xsa", sync); err != nil {
+ count, err := r.MakePatches("xsa", sync)
+ if err != nil {
fmt.Printf("Making patches: %v\n", err)
return 1
}
- xsa.dirty = true
+ if count > 0 {
+ xsa.dirty = true
+ }
}
if xsa.dirty {