aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/sync_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'git-codereview/sync_test.go')
-rw-r--r--git-codereview/sync_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/git-codereview/sync_test.go b/git-codereview/sync_test.go
index 884168c..1dbd7bf 100644
--- a/git-codereview/sync_test.go
+++ b/git-codereview/sync_test.go
@@ -7,6 +7,7 @@ package main
import (
"bytes"
"io/ioutil"
+ "os"
"path/filepath"
"strings"
"testing"
@@ -238,6 +239,29 @@ func TestSyncBranch(t *testing.T) {
"Run 'git codereview mail' to send for review.")
}
+func TestSyncBranchWorktree(t *testing.T) {
+ gt := newGitTest(t)
+ defer gt.done()
+
+ gt.serverWork(t)
+ gt.serverWork(t)
+ trun(t, gt.server, "git", "checkout", "dev.branch")
+ gt.serverWorkUnrelated(t, "")
+ gt.serverWorkUnrelated(t, "")
+ gt.serverWorkUnrelated(t, "")
+ trun(t, gt.server, "git", "checkout", "main")
+
+ wt := filepath.Join(gt.tmpdir, "git-worktree")
+ trun(t, gt.client, "git", "worktree", "add", "-b", "dev.branch", wt, "origin/dev.branch")
+ if err := os.Chdir(wt); err != nil {
+ t.Fatal(err)
+ }
+
+ testMain(t, "sync-branch")
+ testHideRevHashes(t)
+ testPrintedStdout(t, "[dev.branch] all: merge main (REVHASH) into dev.branch")
+}
+
func TestSyncBranchMergeBack(t *testing.T) {
gt := newGitTest(t)
defer gt.done()