aboutsummaryrefslogtreecommitdiffstats
path: root/repository/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/repo.go')
-rw-r--r--repository/repo.go49
1 files changed, 10 insertions, 39 deletions
diff --git a/repository/repo.go b/repository/repo.go
index 7a69a14f..806edace 100644
--- a/repository/repo.go
+++ b/repository/repo.go
@@ -2,9 +2,7 @@
package repository
import (
- "bytes"
"errors"
- "strings"
"github.com/MichaelMure/git-bug/util/lamport"
)
@@ -16,6 +14,14 @@ var (
ErrClockNotExist = errors.New("clock doesn't exist")
)
+// Repo represents a source code repository.
+type Repo interface {
+ RepoConfig
+ RepoKeyring
+ RepoCommon
+ RepoData
+}
+
// RepoConfig access the configuration of a repository
type RepoConfig interface {
// LocalConfig give access to the repository scoped configuration
@@ -46,12 +52,8 @@ type RepoCommon interface {
GetRemotes() (map[string]string, error)
}
-// Repo represents a source code repository.
-type Repo interface {
- RepoConfig
- RepoKeyring
- RepoCommon
-
+// RepoData give access to the git data storage
+type RepoData interface {
// FetchRefs fetch git refs from a remote
FetchRefs(remote string, refSpec string) (string, error)
@@ -122,37 +124,6 @@ type ClockLoader struct {
Witnesser func(repo ClockedRepo) error
}
-func prepareTreeEntries(entries []TreeEntry) bytes.Buffer {
- var buffer bytes.Buffer
-
- for _, entry := range entries {
- buffer.WriteString(entry.Format())
- }
-
- return buffer
-}
-
-func readTreeEntries(s string) ([]TreeEntry, error) {
- split := strings.Split(strings.TrimSpace(s), "\n")
-
- casted := make([]TreeEntry, len(split))
- for i, line := range split {
- if line == "" {
- continue
- }
-
- entry, err := ParseTreeEntry(line)
-
- if err != nil {
- return nil, err
- }
-
- casted[i] = entry
- }
-
- return casted, nil
-}
-
// TestedRepo is an extended ClockedRepo with function for testing only
type TestedRepo interface {
ClockedRepo