]> xenbits.xensource.com Git - people/gdunlap/xsatool/commitdiff
repo init: Enable git rerere on the repos by default
authorGeorge Dunlap <george.dunlap@citrix.com>
Mon, 26 Jun 2017 15:02:54 +0000 (16:02 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Mon, 26 Jun 2017 15:02:54 +0000 (16:02 +0100)
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
README.md
git.go
repo.go

index 866631dd04907ec8e502e323649844ba76807fd8..3cc374ef3cfee186c26d8a04ba86d60a6287be1e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -146,15 +146,14 @@ be consulted.
 and `xsa.git`, it will clone a new copy if one doesn't exist already.
 Existing repositories will be left alone.
 
-- It will also disable the default push on all of those repositories,
-even if they exist already.  (Command `git config
-config.origin.pushurl http://localhost/fail`.)
+- It will also disable the default push and enable `rerere` on all of
+those repositories even if they exist already.  (Commands `git config
+config.origin.pushurl http://localhost/fail` and `git config
+rerere.enabled true`.)
 
 The `--mirrordir` or `--git-proxy` arguments can be used to specify a
 cache used for git clones *during build*.
 
-**TODO**: Enable `git rerere` when creating new repositories
-
 ## Creating or updating the initial global metadata
 
 `xsatool global update`
diff --git a/git.go b/git.go
index 0226d566868dcaa297e1a0a0df3a3cbbdd2b35d9..321d96fd3e97e6034c93e1200c2c6c7730ae99d8 100644 (file)
--- a/git.go
+++ b/git.go
@@ -313,3 +313,8 @@ func (r Repo) DisablePush() (err error) {
        _, err = r.gitCmd("config", node, "http://localhost/fail")
        return
 }
+
+func (r Repo) ConfigEnableRerere() (err error) {
+       _, err = r.gitCmd("config", "rerere.enabled", "true")
+       return
+}
diff --git a/repo.go b/repo.go
index 5c345be5c349564b192006bfff5219a65ffeb609..de147ce69ebdeda0bec96839adf680ae0a45807b 100644 (file)
--- a/repo.go
+++ b/repo.go
@@ -105,6 +105,10 @@ func MainRepoInit(unused *XSAMeta, args []string) (ret int) {
                        err = xr.DisablePush()
                }
 
+               if err == nil {
+                       err = xr.ConfigEnableRerere()
+               }
+
                G.repos.XenRepos[t] = xr
 
                return