summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-11-22 01:51:38 +0300
committerGitHub <noreply@github.com>2018-11-22 01:51:38 +0300
commit021b935ec9897b1d076fc52e5e8dac3984d84ac8 (patch)
treed98f576ba6a6a92091f399c08ac8a21c3c6684da
parentMerge pull request #6 from isacikgoz/develop (diff)
parentminor bugfix on git pull (diff)
downloadgitbatch-021b935ec9897b1d076fc52e5e8dac3984d84ac8.tar.gz
Merge pull request #7 from isacikgoz/develop
minor bugfix on git pull
-rw-r--r--.gitignore1
-rw-r--r--pkg/git/model.go12
-rw-r--r--pkg/git/repository.go7
-rw-r--r--pkg/gui/pullview.go5
4 files changed, 16 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 8c11484..89becf0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
exec.go.test
+test.go
diff --git a/pkg/git/model.go b/pkg/git/model.go
index 2c02eda..0c14fe1 100644
--- a/pkg/git/model.go
+++ b/pkg/git/model.go
@@ -11,9 +11,13 @@ import (
func (entity *RepoEntity) GetRemotes() (remotes []string, err error) {
r := entity.Repository
- remotes, err = getRemotes(&r)
- if err !=nil {
- return nil ,err
+ if list, err := r.Remotes(); err != nil {
+ return remotes, err
+ } else {
+ for _, r := range list {
+ remoteString := r.Config().Name + " → " + r.Config().URLs[0]
+ remotes = append(remotes, remoteString)
+ }
}
return remotes, nil
}
@@ -24,7 +28,7 @@ func getRemotes(r *git.Repository) (remotes []string, err error) {
return remotes, err
} else {
for _, r := range list {
- remoteString := r.Config().Name + " → " + r.Config().URLs[0]
+ remoteString := r.Config().Name
remotes = append(remotes, remoteString)
}
}
diff --git a/pkg/git/repository.go b/pkg/git/repository.go
index 93cdbc9..b3abce7 100644
--- a/pkg/git/repository.go
+++ b/pkg/git/repository.go
@@ -66,10 +66,11 @@ func (entity *RepoEntity) Pull() error {
if err != nil {
return err
}
- ref := plumbing.NewBranchReferenceName(entity.Branch)
+ rf := plumbing.NewBranchReferenceName(entity.Branch)
+ rm := entity.Remote
err = w.Pull(&git.PullOptions{
- RemoteName: entity.Remote,
- ReferenceName: ref,
+ RemoteName: rm,
+ ReferenceName: rf,
})
if err != nil {
return err
diff --git a/pkg/gui/pullview.go b/pkg/gui/pullview.go
index 90e3797..7523bcd 100644
--- a/pkg/gui/pullview.go
+++ b/pkg/gui/pullview.go
@@ -48,10 +48,11 @@ func (gui *Gui) executePull(g *gocui.Gui, v *gocui.View) error {
gui.updateKeyBindingsViewForExecution(g)
for _, mr := range mrs {
- go gui.counter(g)
+ gui.updatePullViewWithExec(g)
// here we will be waiting
mr.Pull()
+ gui.updateCommits(g, mr)
mr.Unmark()
}
@@ -90,7 +91,7 @@ func (gui *Gui) updateKeyBindingsViewForExecution(g *gocui.Gui) error {
return nil
}
-func (gui *Gui) counter(g *gocui.Gui) {
+func (gui *Gui) updatePullViewWithExec(g *gocui.Gui) {
v, err := g.View("pull")
if err != nil {