]> xenbits.xensource.com Git - people/gdunlap/xsatool/commitdiff
git: Add Repo.ResetBranch
authorGeorge Dunlap <george.dunlap@citrix.com>
Wed, 10 May 2017 16:01:14 +0000 (17:01 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 10 May 2017 16:01:14 +0000 (17:01 +0100)
To check out a particular branch.  This will be used in testing to set
up a particular view of the tree.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
git.go

diff --git a/git.go b/git.go
index 0bd2a056b1b11d67253ccdabdb550c14dc2d0422..8faa2ddf459f1600f6367430bf221e407dac4885 100644 (file)
--- a/git.go
+++ b/git.go
@@ -112,6 +112,12 @@ func (r Repo) DeleteBranch(branch string) (out []byte, err error) {
        return
 }
 
+func (r Repo) ResetBranch(branch string, commit string) (out []byte, err error) {
+       out, err = r.gitCmd("checkout", "-B", branch, commit)
+
+       return
+}
+
 func (r Repo) FormatPatch(path string, baseline string, branch string) (out []byte, err error) {
        out, err = r.gitCmd("format-patch", "-o"+path, baseline+".."+branch)