1// Package repository contains helper methods for working with a Git repo.
2package repository
3
4import "github.com/MichaelMure/git-bug/util"
5
6// Repo represents a source code repository.
7type Repo interface {
8 // GetPath returns the path to the repo.
9 GetPath() string
10
11 // GetUserName returns the name the the user has used to configure git
12 GetUserName() (string, error)
13
14 // GetUserEmail returns the email address that the user has used to configure git.
15 GetUserEmail() (string, error)
16
17 // GetCoreEditor returns the name of the editor that the user has used to configure git.
18 GetCoreEditor() (string, error)
19
20 // PullRefs pull git refs from a remote
21 PullRefs(remote string, refPattern string, remoteRefPattern string) error
22
23 // PushRefs push git refs to a remote
24 PushRefs(remote string, refPattern string) error
25
26 // StoreData will store arbitrary data and return the corresponding hash
27 StoreData(data []byte) (util.Hash, error)
28
29 // StoreTree will store a mapping key-->Hash as a Git tree
30 StoreTree(mapping map[string]util.Hash) (util.Hash, error)
31
32 // StoreCommit will store a Git commit with the given Git tree
33 StoreCommit(treeHash util.Hash) (util.Hash, error)
34
35 // StoreCommit will store a Git commit with the given Git tree
36 StoreCommitWithParent(treeHash util.Hash, parent util.Hash) (util.Hash, error)
37
38 // UpdateRef will create or update a Git reference
39 UpdateRef(ref string, hash util.Hash) error
40}