return lines[0], nil
}
+// Return the hash of the tree corresponding to the reference
+func (r Repo) TreeRef(ref string) (string, error) {
+ ref = ref + ":"
+ out, err := r.gitCmd("rev-parse", "--verify", ref)
+ if err != nil {
+ return "", err
+ }
+ lines := strings.Split(string(out), "\n")
+ if len(lines) != 2 {
+ return "", fmt.Errorf("Multiple lines in output")
+ }
+ return lines[0], nil
+}
+
// This wants SetRefSafe, which uses the "compare exchange" provided by git
func (r Repo) SetRef(ref string, value string) (out []byte, err error) {
out, err = r.gitCmd("update-ref", ref, value)