aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-03-01 23:17:57 +0100
committerGitHub <noreply@github.com>2019-03-01 23:17:57 +0100
commit7260ca05bc3588c0572887a7d8f1b897c7fc13da (patch)
tree66854358df3cb9de651f7688556ec5a4b8ab1868 /repository/git.go
parent0aefae6fcca5786f2c898029c3d6282f760f2c63 (diff)
parentb6bed784e5664819250aac20b2b9690879ee6ab1 (diff)
downloadgit-bug-7260ca05bc3588c0572887a7d8f1b897c7fc13da.tar.gz
Merge pull request #89 from MichaelMure/identity
WIP identity in git
Diffstat (limited to 'repository/git.go')
-rw-r--r--repository/git.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/repository/git.go b/repository/git.go
index c2f0da0a..c982f820 100644
--- a/repository/git.go
+++ b/repository/git.go
@@ -20,6 +20,8 @@ const editClockFile = "/.git/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 _ ClockedRepo = &GitRepo{}
+
// GitRepo represents an instance of a (local) git repository.
type GitRepo struct {
Path string
@@ -29,7 +31,7 @@ type GitRepo struct {
// Run the given git command with the given I/O reader/writers, returning an error if it fails.
func (repo *GitRepo) runGitCommandWithIO(stdin io.Reader, stdout, stderr io.Writer, args ...string) error {
- //fmt.Println("Running git", strings.Join(args, " "))
+ // fmt.Printf("[%s] Running git %s\n", repo.Path, strings.Join(args, " "))
cmd := exec.Command("git", args...)
cmd.Dir = repo.Path
@@ -202,7 +204,7 @@ func (repo *GitRepo) ReadConfigs(keyPrefix string) (map[string]string, error) {
// RmConfigs remove all key/value pair matching the key prefix
func (repo *GitRepo) RmConfigs(keyPrefix string) error {
- _, err := repo.runGitCommand("config", "--remove-section", keyPrefix)
+ _, err := repo.runGitCommand("config", "--unset-all", keyPrefix)
return err
}
@@ -440,11 +442,21 @@ func (repo *GitRepo) WriteClocks() error {
return nil
}
+// CreateTime return the current value of the creation clock
+func (repo *GitRepo) CreateTime() lamport.Time {
+ return repo.createClock.Time()
+}
+
// CreateTimeIncrement increment the creation clock and return the new value.
func (repo *GitRepo) CreateTimeIncrement() (lamport.Time, error) {
return repo.createClock.Increment()
}
+// EditTime return the current value of the edit clock
+func (repo *GitRepo) EditTime() lamport.Time {
+ return repo.editClock.Time()
+}
+
// EditTimeIncrement increment the edit clock and return the new value.
func (repo *GitRepo) EditTimeIncrement() (lamport.Time, error) {
return repo.editClock.Increment()