1
0
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:
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" "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()

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'?")). 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()
}, },
}) })