aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
authorMichael Muré <michael.mure@consensys.net>2019-02-03 19:55:35 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:40:23 +0100
commit328a4e5abf3ec8ea41f89575fcfb83cf9f086c80 (patch)
tree29ce99a1cb244badd74acb61d2b251e56fd1643f /bug
parent56c6147eb6012252cf0b723b9eb6d1e841fc2f94 (diff)
downloadgit-bug-328a4e5abf3ec8ea41f89575fcfb83cf9f086c80.tar.gz
identity: wip push/pull
Diffstat (limited to 'bug')
-rw-r--r--bug/bug.go4
-rw-r--r--bug/bug_actions.go12
2 files changed, 11 insertions, 5 deletions
diff --git a/bug/bug.go b/bug/bug.go
index aec9a12e..1717dd66 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -6,12 +6,12 @@ import (
"fmt"
"strings"
- "github.com/MichaelMure/git-bug/identity"
+ "github.com/pkg/errors"
+ "github.com/MichaelMure/git-bug/identity"
"github.com/MichaelMure/git-bug/repository"
"github.com/MichaelMure/git-bug/util/git"
"github.com/MichaelMure/git-bug/util/lamport"
- "github.com/pkg/errors"
)
const bugsRefPattern = "refs/bugs/"
diff --git a/bug/bug_actions.go b/bug/bug_actions.go
index a21db826..6b9135b0 100644
--- a/bug/bug_actions.go
+++ b/bug/bug_actions.go
@@ -8,7 +8,7 @@ import (
"github.com/pkg/errors"
)
-// Fetch retrieve update from a remote
+// Fetch retrieve updates from a remote
// This does not change the local bugs state
func Fetch(repo repository.Repo, remote string) (string, error) {
remoteRefSpec := fmt.Sprintf(bugsRemoteRefPattern, remote)
@@ -23,7 +23,7 @@ func Push(repo repository.Repo, remote string) (string, error) {
}
// Pull will do a Fetch + MergeAll
-// This function won't give details on the underlying process. If you need more
+// This function won't give details on the underlying process. If you need more,
// use Fetch and MergeAll separately.
func Pull(repo repository.ClockedRepo, remote string) error {
_, err := Fetch(repo, remote)
@@ -45,7 +45,13 @@ func Pull(repo repository.ClockedRepo, remote string) error {
return nil
}
-// MergeAll will merge all the available remote bug
+// MergeAll will merge all the available remote bug:
+//
+// - If the remote has new commit, the local bug is updated to match the same history
+// (fast-forward update)
+// - if the local bug has new commits but the remote don't, nothing is changed
+// - if both local and remote bug have new commits (that is, we have a concurrent edition),
+// new local commits are rewritten at the head of the remote history (that is, a rebase)
func MergeAll(repo repository.ClockedRepo, remote string) <-chan MergeResult {
out := make(chan MergeResult)