[patch] Force fetch origin in patch
This patch is to address an issue caused by new cache logics that
causing jiri not fetching the origin/master when it tries to rebase
the change to the ToT, causing strange merge conflicts.
Bug: 36052
Change-Id: I172f9e875d29918648ea2f4ebd172acaf0ce9af6
diff --git a/cmd/jiri/patch.go b/cmd/jiri/patch.go
index dc27721..a2c7019 100644
--- a/cmd/jiri/patch.go
+++ b/cmd/jiri/patch.go
@@ -216,6 +216,11 @@
return fmt.Errorf("Rebase: cannot get user info for HEAD: %s", err)
}
scm = gitutil.New(jirix, gitutil.UserNameOpt(name), gitutil.UserEmailOpt(email), gitutil.RootDirOpt(project.Path))
+ if err := scm.Fetch("origin", gitutil.PruneOpt(true)); err != nil {
+ jirix.Logger.Errorf("Not able to fetch origin: %v", err)
+ jirix.IncrementFailures()
+ return nil
+ }
if err := scm.FetchRefspec("origin", revision); err != nil {
jirix.Logger.Errorf("Not able to fetch revision %q: %s", revision, err)
jirix.IncrementFailures()