aboutsummaryrefslogtreecommitdiffstats
path: root/repository
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-12 21:09:30 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-12 21:09:30 +0200
commite2f4b027c946831c3f4f119d87a80513c7cf8fdc (patch)
treeb2ec57c89c49062ab2e8adeacb2646d2f152db80 /repository
parent721ed3248e8bf167a89df14d9fc2bf5b0fe45753 (diff)
downloadgit-bug-e2f4b027c946831c3f4f119d87a80513c7cf8fdc.tar.gz
termui: implement push/pull
Diffstat (limited to 'repository')
-rw-r--r--repository/git.go16
-rw-r--r--repository/mock_repo.go8
-rw-r--r--repository/repo.go4
3 files changed, 14 insertions, 14 deletions
diff --git a/repository/git.go b/repository/git.go
index 5748d52a..dc071fdc 100644
--- a/repository/git.go
+++ b/repository/git.go
@@ -151,24 +151,24 @@ func (repo *GitRepo) GetCoreEditor() (string, error) {
}
// FetchRefs fetch git refs from a remote
-func (repo *GitRepo) FetchRefs(remote, refSpec string) error {
- err := repo.runGitCommandInline("fetch", remote, refSpec)
+func (repo *GitRepo) FetchRefs(remote, refSpec string) (string, error) {
+ stdout, err := repo.runGitCommand("fetch", remote, refSpec)
if err != nil {
- return fmt.Errorf("failed to fetch from the remote '%s': %v", remote, err)
+ return stdout, fmt.Errorf("failed to fetch from the remote '%s': %v", remote, err)
}
- return err
+ return stdout, err
}
// PushRefs push git refs to a remote
-func (repo *GitRepo) PushRefs(remote string, refSpec string) error {
- err := repo.runGitCommandInline("push", remote, refSpec)
+func (repo *GitRepo) PushRefs(remote string, refSpec string) (string, error) {
+ stdout, stderr, err := repo.runGitCommandRaw(nil, "push", remote, refSpec)
if err != nil {
- return fmt.Errorf("failed to push to the remote '%s': %v", remote, err)
+ return stdout + stderr, fmt.Errorf("failed to push to the remote '%s': %v", remote, err)
}
- return nil
+ return stdout + stderr, nil
}
// StoreData will store arbitrary data and return the corresponding hash
diff --git a/repository/mock_repo.go b/repository/mock_repo.go
index eb48f85f..20fb3d87 100644
--- a/repository/mock_repo.go
+++ b/repository/mock_repo.go
@@ -54,12 +54,12 @@ func (r *mockRepoForTest) GetCoreEditor() (string, error) {
}
// PushRefs push git refs to a remote
-func (r *mockRepoForTest) PushRefs(remote string, refSpec string) error {
- return nil
+func (r *mockRepoForTest) PushRefs(remote string, refSpec string) (string, error) {
+ return "", nil
}
-func (r *mockRepoForTest) FetchRefs(remote string, refSpec string) error {
- return nil
+func (r *mockRepoForTest) FetchRefs(remote string, refSpec string) (string, error) {
+ return "", nil
}
func (r *mockRepoForTest) StoreData(data []byte) (util.Hash, error) {
diff --git a/repository/repo.go b/repository/repo.go
index 057223ad..372a8066 100644
--- a/repository/repo.go
+++ b/repository/repo.go
@@ -22,10 +22,10 @@ type Repo interface {
GetCoreEditor() (string, error)
// FetchRefs fetch git refs from a remote
- FetchRefs(remote string, refSpec string) error
+ FetchRefs(remote string, refSpec string) (string, error)
// PushRefs push git refs to a remote
- PushRefs(remote string, refSpec string) error
+ PushRefs(remote string, refSpec string) (string, error)
// StoreData will store arbitrary data and return the corresponding hash
StoreData(data []byte) (util.Hash, error)