diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-07 17:10:40 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-07 17:10:40 +0200 |
commit | 61a1173ec3f202b9dc71236205de785e2a454791 (patch) | |
tree | 80b9661b1da37baacd324f32421d7fa6fc18e3ff /bug/bug_actions.go | |
parent | 265ecd81d22c39cc6daccd938a1d41c5ffab23ad (diff) | |
download | git-bug-61a1173ec3f202b9dc71236205de785e2a454791.tar.gz git-bug-61a1173ec3f202b9dc71236205de785e2a454791.zip |
bug: refactor the Pull code to have the message formating in the upper layers
Diffstat (limited to 'bug/bug_actions.go')
-rw-r--r-- | bug/bug_actions.go | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/bug/bug_actions.go b/bug/bug_actions.go index f9e6d0c6..37c3aa05 100644 --- a/bug/bug_actions.go +++ b/bug/bug_actions.go @@ -2,8 +2,6 @@ package bug import ( "fmt" - "io" - "io/ioutil" "strings" "github.com/MichaelMure/git-bug/repository" @@ -28,33 +26,19 @@ func Push(repo repository.Repo, remote string) (string, error) { return repo.PushRefs(remote, bugsRefPattern+"*") } -// Pull does a Fetch and merge the updates into the local bug states -func Pull(repo repository.Repo, out io.Writer, remote string) error { - // TODO: return a chan of changes for the cache to be updated properly - - if out == nil { - out = ioutil.Discard - } - - fmt.Fprintf(out, "Fetching remote ...\n") - - stdout, err := Fetch(repo, remote) +// Pull will do a Fetch + MergeAll +// This function won't give details on the underlying process. If you need more +// use Fetch and MergeAll separately. +func Pull(repo repository.Repo, remote string) error { + _, err := Fetch(repo, remote) if err != nil { return err } - out.Write([]byte(stdout)) - - fmt.Fprintf(out, "Merging data ...\n") - for merge := range MergeAll(repo, remote) { if merge.Err != nil { return merge.Err } - - if merge.Status != MsgMergeNothing { - fmt.Fprintf(out, "%s: %s\n", merge.HumanId, merge.Status) - } } return nil |