aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-12 15:14:37 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-12 21:32:09 +0200
commitcda8114fda8d349bbaeefb42cc33ba715d41cf08 (patch)
tree45c96a8d07db89ff66519ae1e29b44648c1b5e37 /repository/git.go
parentdf67212fee5ae5381b13b2c7d6ce92e1bdb66e0f (diff)
downloadgit-bug-cda8114fda8d349bbaeefb42cc33ba715d41cf08.tar.gz
store user info in the datastore
Diffstat (limited to 'repository/git.go')
-rw-r--r--repository/git.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/repository/git.go b/repository/git.go
index 309641f6..679d24fc 100644
--- a/repository/git.go
+++ b/repository/git.go
@@ -114,6 +114,17 @@ func (repo *GitRepo) PushRefs(remote string, refPattern string) error {
return nil
}
+// StoreData will store arbitrary data and return the corresponding hash
+func (repo *GitRepo) StoreData(data []byte) (Hash, error) {
+ var stdin = bytes.NewReader(data)
+ var stdout bytes.Buffer
+ var stderr bytes.Buffer
+
+ err := repo.runGitCommandWithIO(stdin, &stdout, &stderr, "hash-object", "--stdin", "-w")
+
+ return Hash(stdout.String()), err
+}
+
/*
//
//// GetSubmitStrategy returns the way in which a review is submitted