mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-12-19 09:22:30 +03:00
Fix deleting a remote branch when a remote tag with the same name exists
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RemoteCommands struct {
|
type RemoteCommands struct {
|
||||||
@@ -52,7 +53,7 @@ func (self *RemoteCommands) UpdateRemoteUrl(remoteName string, updatedUrl string
|
|||||||
func (self *RemoteCommands) DeleteRemoteBranch(task gocui.Task, remoteName string, branchNames []string) error {
|
func (self *RemoteCommands) DeleteRemoteBranch(task gocui.Task, remoteName string, branchNames []string) error {
|
||||||
cmdArgs := NewGitCmd("push").
|
cmdArgs := NewGitCmd("push").
|
||||||
Arg(remoteName, "--delete").
|
Arg(remoteName, "--delete").
|
||||||
Arg(branchNames...).
|
Arg(lo.Map(branchNames, func(b string, _ int) string { return "refs/heads/" + b })...).
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run()
|
return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run()
|
||||||
|
|||||||
@@ -40,15 +40,9 @@ var DeleteRemoteBranchWhenTagWithSameNameExists = NewIntegrationTest(NewIntegrat
|
|||||||
Content(Equals("Are you sure you want to delete the remote branch 'xyz' from 'origin'?")).
|
Content(Equals("Are you sure you want to delete the remote branch 'xyz' from 'origin'?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
/* EXPECTED:
|
|
||||||
t.Views().RemoteBranches().
|
t.Views().RemoteBranches().
|
||||||
Lines(
|
Lines(
|
||||||
Contains("master").IsSelected(),
|
Contains("master").IsSelected(),
|
||||||
)
|
)
|
||||||
ACTUAL: */
|
|
||||||
t.ExpectPopup().Alert().
|
|
||||||
Title(Equals("Error")).
|
|
||||||
Content(Contains("error: dst refspec xyz matches more than one")).
|
|
||||||
Confirm()
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user