1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-20 00:12:29 +02:00

Fix deleting a remote branch when a remote tag with the same name exists

This commit is contained in:
Stefan Haller
2025-11-27 19:48:18 +01:00
parent 4d4b143cc7
commit 7809823064
2 changed files with 2 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import (
"strings"
"github.com/jesseduffield/gocui"
"github.com/samber/lo"
)
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 {
cmdArgs := NewGitCmd("push").
Arg(remoteName, "--delete").
Arg(branchNames...).
Arg(lo.Map(branchNames, func(b string, _ int) string { return "refs/heads/" + b })...).
ToArgv()
return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run()

View File

@@ -40,15 +40,9 @@ var DeleteRemoteBranchWhenTagWithSameNameExists = NewIntegrationTest(NewIntegrat
Content(Equals("Are you sure you want to delete the remote branch 'xyz' from 'origin'?")).
Confirm()
/* EXPECTED:
t.Views().RemoteBranches().
Lines(
Contains("master").IsSelected(),
)
ACTUAL: */
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Contains("error: dst refspec xyz matches more than one")).
Confirm()
},
})