diff options
author | Jordan <46637683+JordanllHarper@users.noreply.github.com> | 2024-06-01 20:17:36 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-06-02 09:02:33 +0200 |
commit | 39ea5d9ab1e394d626567d4c01713873048e204c (patch) | |
tree | 2cbcf94a5605bcccd6105cd30ec5dda486aeeb9c /pkg | |
parent | 205357a44f8ff2b344e87e79fd78313659611c97 (diff) |
Add HEAD: when referencing upstream branch
Update unit tests
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/git_commands/sync.go | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/sync_test.go | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/commands/git_commands/sync.go b/pkg/commands/git_commands/sync.go index 1c93fc260..7ab209c0e 100644 --- a/pkg/commands/git_commands/sync.go +++ b/pkg/commands/git_commands/sync.go @@ -35,7 +35,7 @@ func (self *SyncCommands) PushCmdObj(task gocui.Task, opts PushOpts) (oscommands ArgIf(opts.ForceWithLease, "--force-with-lease"). ArgIf(opts.SetUpstream, "--set-upstream"). ArgIf(opts.UpstreamRemote != "", opts.UpstreamRemote). - ArgIf(opts.UpstreamBranch != "", opts.UpstreamBranch). + ArgIf(opts.UpstreamBranch != "", "HEAD:"+opts.UpstreamBranch). ToArgv() cmdObj := self.cmd.New(cmdArgs).PromptOnCredentialRequest(task) diff --git a/pkg/commands/git_commands/sync_test.go b/pkg/commands/git_commands/sync_test.go index 6ff8da840..353ac72aa 100644 --- a/pkg/commands/git_commands/sync_test.go +++ b/pkg/commands/git_commands/sync_test.go @@ -48,7 +48,7 @@ func TestSyncPush(t *testing.T) { UpstreamBranch: "master", }, test: func(cmdObj oscommands.ICmdObj, err error) { - assert.Equal(t, cmdObj.Args(), []string{"git", "push", "origin", "master"}) + assert.Equal(t, cmdObj.Args(), []string{"git", "push", "origin", "HEAD:master"}) assert.NoError(t, err) }, }, @@ -61,7 +61,7 @@ func TestSyncPush(t *testing.T) { SetUpstream: true, }, test: func(cmdObj oscommands.ICmdObj, err error) { - assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--set-upstream", "origin", "master"}) + assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--set-upstream", "origin", "HEAD:master"}) assert.NoError(t, err) }, }, @@ -74,7 +74,7 @@ func TestSyncPush(t *testing.T) { SetUpstream: true, }, test: func(cmdObj oscommands.ICmdObj, err error) { - assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--force-with-lease", "--set-upstream", "origin", "master"}) + assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--force-with-lease", "--set-upstream", "origin", "HEAD:master"}) assert.NoError(t, err) }, }, |