diff options
author | Michael Muré <batolettre@gmail.com> | 2020-10-04 20:09:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 20:09:36 +0200 |
commit | d56ce3d5d9f5ef74201a8ee7c25be4820d435b47 (patch) | |
tree | 4382550c1e8387b7cb6b13c6dd32508c24e6c4ca /repository | |
parent | 9bc2483df054387c1241b2e1644ab7e6e9bc4e9a (diff) | |
parent | 1eb13173183cf402e4197be51935a4b3ddacf256 (diff) | |
download | git-bug-d56ce3d5d9f5ef74201a8ee7c25be4820d435b47.tar.gz |
Merge pull request #460 from MichaelMure/fix-push
repo: use go-git in more places, fix push
Diffstat (limited to 'repository')
-rw-r--r-- | repository/git_testing.go | 6 | ||||
-rw-r--r-- | repository/gogit.go | 30 |
2 files changed, 27 insertions, 9 deletions
diff --git a/repository/git_testing.go b/repository/git_testing.go index 7d40bf1f..874cc86c 100644 --- a/repository/git_testing.go +++ b/repository/git_testing.go @@ -44,9 +44,9 @@ func CreateTestRepo(bare bool) TestedRepo { } func SetupReposAndRemote() (repoA, repoB, remote TestedRepo) { - repoA = CreateTestRepo(false) - repoB = CreateTestRepo(false) - remote = CreateTestRepo(true) + repoA = CreateGoGitTestRepo(false) + repoB = CreateGoGitTestRepo(false) + remote = CreateGoGitTestRepo(true) remoteAddr := "file://" + remote.GetPath() diff --git a/repository/gogit.go b/repository/gogit.go index b907c070..c0179628 100644 --- a/repository/gogit.go +++ b/repository/gogit.go @@ -138,10 +138,16 @@ func InitGoGitRepo(path string) (*GoGitRepo, error) { return nil, err } + k, err := defaultKeyring() + if err != nil { + return nil, err + } + return &GoGitRepo{ - r: r, - path: path + "/.git", - clocks: make(map[string]lamport.Clock), + r: r, + path: path + "/.git", + clocks: make(map[string]lamport.Clock), + keyring: k, }, nil } @@ -152,10 +158,16 @@ func InitBareGoGitRepo(path string) (*GoGitRepo, error) { return nil, err } + k, err := defaultKeyring() + if err != nil { + return nil, err + } + return &GoGitRepo{ - r: r, - path: path, - clocks: make(map[string]lamport.Clock), + r: r, + path: path, + clocks: make(map[string]lamport.Clock), + keyring: k, }, nil } @@ -276,6 +288,9 @@ func (repo *GoGitRepo) FetchRefs(remote string, refSpec string) (string, error) RefSpecs: []config.RefSpec{config.RefSpec(refSpec)}, Progress: buf, }) + if err == gogit.NoErrAlreadyUpToDate { + return "already up-to-date", nil + } if err != nil { return "", err } @@ -292,6 +307,9 @@ func (repo *GoGitRepo) PushRefs(remote string, refSpec string) (string, error) { RefSpecs: []config.RefSpec{config.RefSpec(refSpec)}, Progress: buf, }) + if err == gogit.NoErrAlreadyUpToDate { + return "already up-to-date", nil + } if err != nil { return "", err } |