diff options
Diffstat (limited to 'repository')
-rw-r--r-- | repository/config.go | 2 | ||||
-rw-r--r-- | repository/config_git.go | 2 | ||||
-rw-r--r-- | repository/git.go | 20 | ||||
-rw-r--r-- | repository/mock_repo.go | 4 | ||||
-rw-r--r-- | repository/repo.go | 14 |
5 files changed, 24 insertions, 18 deletions
diff --git a/repository/config.go b/repository/config.go index d72e7b4e..4fa5c69b 100644 --- a/repository/config.go +++ b/repository/config.go @@ -38,7 +38,7 @@ type Config interface { RemoveAll(keyPrefix string) error } -func parseTimestamp(s string) (time.Time, error) { +func ParseTimestamp(s string) (time.Time, error) { timestamp, err := strconv.Atoi(s) if err != nil { return time.Time{}, err diff --git a/repository/config_git.go b/repository/config_git.go index 63ca2457..cff82afb 100644 --- a/repository/config_git.go +++ b/repository/config_git.go @@ -116,7 +116,7 @@ func (gc *gitConfig) ReadTimestamp(key string) (time.Time, error) { if err != nil { return time.Time{}, err } - return parseTimestamp(value) + return ParseTimestamp(value) } func (gc *gitConfig) rmSection(keyPrefix string) error { diff --git a/repository/git.go b/repository/git.go index 2b00d1f2..d4560805 100644 --- a/repository/git.go +++ b/repository/git.go @@ -15,11 +15,15 @@ import ( "github.com/MichaelMure/git-bug/util/lamport" ) -const createClockFile = "/git-bug/create-clock" -const editClockFile = "/git-bug/edit-clock" +const ( + createClockFile = "/git-bug/create-clock" + editClockFile = "/git-bug/edit-clock" +) -// ErrNotARepo is the error returned when the git repo root wan't be found -var ErrNotARepo = errors.New("not a git repository") +var ( + // ErrNotARepo is the error returned when the git repo root wan't be found + ErrNotARepo = errors.New("not a git repository") +) var _ ClockedRepo = &GitRepo{} @@ -457,14 +461,14 @@ func (repo *GitRepo) EditTimeIncrement() (lamport.Time, error) { return repo.editClock.Increment() } -// CreateWitness witness another create time and increment the corresponding clock +// WitnessCreate witness another create time and increment the corresponding clock // if needed. -func (repo *GitRepo) CreateWitness(time lamport.Time) error { +func (repo *GitRepo) WitnessCreate(time lamport.Time) error { return repo.createClock.Witness(time) } -// EditWitness witness another edition time and increment the corresponding clock +// WitnessEdit witness another edition time and increment the corresponding clock // if needed. -func (repo *GitRepo) EditWitness(time lamport.Time) error { +func (repo *GitRepo) WitnessEdit(time lamport.Time) error { return repo.editClock.Witness(time) } diff --git a/repository/mock_repo.go b/repository/mock_repo.go index 26c02ede..88c5a132 100644 --- a/repository/mock_repo.go +++ b/repository/mock_repo.go @@ -236,12 +236,12 @@ func (r *mockRepoForTest) EditTimeIncrement() (lamport.Time, error) { return r.editClock.Increment(), nil } -func (r *mockRepoForTest) CreateWitness(time lamport.Time) error { +func (r *mockRepoForTest) WitnessCreate(time lamport.Time) error { r.createClock.Witness(time) return nil } -func (r *mockRepoForTest) EditWitness(time lamport.Time) error { +func (r *mockRepoForTest) WitnessEdit(time lamport.Time) error { r.editClock.Witness(time) return nil } diff --git a/repository/repo.go b/repository/repo.go index 7d655bde..71bd7a8e 100644 --- a/repository/repo.go +++ b/repository/repo.go @@ -10,8 +10,10 @@ import ( "github.com/MichaelMure/git-bug/util/lamport" ) -var ErrNoConfigEntry = errors.New("no config entry for the given key") -var ErrMultipleConfigEntry = errors.New("multiple config entry for the given key") +var ( + ErrNoConfigEntry = errors.New("no config entry for the given key") + ErrMultipleConfigEntry = errors.New("multiple config entry for the given key") +) // RepoCommon represent the common function the we want all the repo to implement type RepoCommon interface { @@ -109,13 +111,13 @@ type ClockedRepo interface { // EditTimeIncrement increment the edit clock and return the new value. EditTimeIncrement() (lamport.Time, error) - // CreateWitness witness another create time and increment the corresponding + // WitnessCreate witness another create time and increment the corresponding // clock if needed. - CreateWitness(time lamport.Time) error + WitnessCreate(time lamport.Time) error - // EditWitness witness another edition time and increment the corresponding + // WitnessEdit witness another edition time and increment the corresponding // clock if needed. - EditWitness(time lamport.Time) error + WitnessEdit(time lamport.Time) error } // Witnesser is a function that will initialize the clocks of a repo |