From 5c4e7de01281da51e32b4926dc0ef15b17a2d397 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 21 Dec 2020 11:05:47 +0100 Subject: repository: partially add two new functions to RepoData --- repository/repo.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'repository/repo.go') diff --git a/repository/repo.go b/repository/repo.go index 625e0143..afd8ff77 100644 --- a/repository/repo.go +++ b/repository/repo.go @@ -88,6 +88,12 @@ type RepoBleve interface { ClearBleveIndex(name string) error } +type Commit struct { + Hash Hash + Parents []Hash + TreeHash Hash +} + // RepoData give access to the git data storage type RepoData interface { // FetchRefs fetch git refs from a remote @@ -115,11 +121,12 @@ type RepoData interface { // StoreCommit will store a Git commit with the given Git tree StoreCommitWithParent(treeHash Hash, parent Hash) (Hash, error) + ReadCommit(hash Hash) (Commit, error) + // GetTreeHash return the git tree hash referenced in a commit GetTreeHash(commit Hash) (Hash, error) - // FindCommonAncestor will return the last common ancestor of two chain of commit - FindCommonAncestor(commit1 Hash, commit2 Hash) (Hash, error) + ResolveRef(ref string) (Hash, error) // UpdateRef will create or update a Git reference UpdateRef(ref string, hash Hash) error @@ -136,7 +143,12 @@ type RepoData interface { // CopyRef will create a new reference with the same value as another one CopyRef(source string, dest string) error + // FindCommonAncestor will return the last common ancestor of two chain of commit + // Deprecated + 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) } -- cgit