aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
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