diff options
author | Michael Muré <batolettre@gmail.com> | 2021-01-03 23:59:25 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:19:00 +0100 |
commit | 8d63c983c982f93cc48d3996d6bd097ddeeb327f (patch) | |
tree | 94d85594e11965f9780df53a5c0c2b2550c02184 /repository/repo.go | |
parent | 4ef92efeb905102d37b81fafa0ac2173594ef30a (diff) | |
download | git-bug-8d63c983c982f93cc48d3996d6bd097ddeeb327f.tar.gz |
WIP
Diffstat (limited to 'repository/repo.go')
-rw-r--r-- | repository/repo.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/repository/repo.go b/repository/repo.go index afd8ff77..d7afa983 100644 --- a/repository/repo.go +++ b/repository/repo.go @@ -3,15 +3,17 @@ package repository import ( "errors" + "io" "github.com/blevesearch/bleve" "github.com/go-git/go-billy/v5" + "golang.org/x/crypto/openpgp" "github.com/MichaelMure/git-bug/util/lamport" ) var ( - // ErrNotARepo is the error returned when the git repo root wan't be found + // ErrNotARepo is the error returned when the git repo root can't be found ErrNotARepo = errors.New("not a git repository") // ErrClockNotExist is the error returned when a clock can't be found ErrClockNotExist = errors.New("clock doesn't exist") @@ -89,9 +91,11 @@ type RepoBleve interface { } type Commit struct { - Hash Hash - Parents []Hash - TreeHash Hash + Hash Hash + Parents []Hash // hashes of the parents, if any + TreeHash Hash // hash of the git Tree + SignedData io.Reader // if signed, reader for the signed data (likely, the serialized commit) + Signature io.Reader // if signed, reader for the (non-armored) signature } // RepoData give access to the git data storage @@ -116,21 +120,29 @@ type RepoData interface { ReadTree(hash Hash) ([]TreeEntry, error) // StoreCommit will store a Git commit with the given Git tree - StoreCommit(treeHash Hash) (Hash, error) + StoreCommit(treeHash Hash, parents ...Hash) (Hash, error) - // StoreCommit will store a Git commit with the given Git tree - StoreCommitWithParent(treeHash Hash, parent Hash) (Hash, error) + // StoreCommit will store a Git commit with the given Git tree. If signKey is not nil, the commit + // will be signed accordingly. + StoreSignedCommit(treeHash Hash, signKey *openpgp.Entity, parents ...Hash) (Hash, error) + // ReadCommit read a Git commit and returns some of its characteristic ReadCommit(hash Hash) (Commit, error) // GetTreeHash return the git tree hash referenced in a commit GetTreeHash(commit Hash) (Hash, error) + // ResolveRef returns the hash of the target commit of the given ref ResolveRef(ref string) (Hash, error) // UpdateRef will create or update a Git reference UpdateRef(ref string, hash Hash) error + // // MergeRef merge other into ref and update the reference + // // If the update is not fast-forward, the callback treeHashFn will be called for the caller to generate + // // the Tree to store in the merge commit. + // MergeRef(ref string, otherRef string, treeHashFn func() Hash) error + // RemoveRef will remove a Git reference RemoveRef(ref string) error @@ -148,7 +160,6 @@ type RepoData interface { FindCommonAncestor(commit1 Hash, commit2 Hash) (Hash, error) // ListCommits will return the list of tree hashes of a ref, in chronological order - // Deprecated ListCommits(ref string) ([]Hash, error) } |