mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
Add option to delete local and remote tag
This commit is contained in:
committed by
Jesse Duffield
parent
abf914c923
commit
7db8fb8e9c
@@ -190,6 +190,10 @@ func (self *Shell) Revert(ref string) *Shell {
|
||||
return self.RunCommand([]string{"git", "revert", ref})
|
||||
}
|
||||
|
||||
func (self *Shell) AssertRemoteTagNotFound(upstream, name string) *Shell {
|
||||
return self.RunCommandExpectError([]string{"git", "ls-remote", "--exit-code", upstream, fmt.Sprintf("refs/tags/%s", name)})
|
||||
}
|
||||
|
||||
func (self *Shell) CreateLightweightTag(name string, ref string) *Shell {
|
||||
return self.RunCommand([]string{"git", "tag", name, ref})
|
||||
}
|
||||
|
||||
75
pkg/integration/tests/tag/delete_local_and_remote.go
Normal file
75
pkg/integration/tests/tag/delete_local_and_remote.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package tag
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var DeleteLocalAndRemote = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Create and delete both local and remote annotated tag",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.CloneIntoRemote("origin")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Tags().
|
||||
Focus().
|
||||
IsEmpty().
|
||||
Press(keys.Universal.New).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Title(Equals("Tag name")).
|
||||
Type("new-tag").
|
||||
SwitchToDescription().
|
||||
Title(Equals("Tag description")).
|
||||
Type("message").
|
||||
SwitchToSummary().
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
MatchesRegexp(`new-tag.*message`).IsSelected(),
|
||||
).
|
||||
Press(keys.Universal.Push).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Remote to push tag 'new-tag' to:")).
|
||||
InitialText(Equals("origin")).
|
||||
SuggestionLines(
|
||||
Contains("origin"),
|
||||
).
|
||||
Confirm()
|
||||
}).
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Menu().
|
||||
Title(Equals("Delete tag 'new-tag'?")).
|
||||
Select(Contains("Delete local and remote tag")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Remote from which to remove tag 'new-tag':")).
|
||||
InitialText(Equals("origin")).
|
||||
SuggestionLines(
|
||||
Contains("origin"),
|
||||
).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Confirmation().
|
||||
Title(Equals("Delete tag 'new-tag'?")).
|
||||
Content(Equals("Are you sure you want to delete 'new-tag' from both your machine and from 'origin'?")).
|
||||
Confirm()
|
||||
}).
|
||||
IsEmpty().
|
||||
Press(keys.Universal.New).
|
||||
Tap(func() {
|
||||
t.Shell().AssertRemoteTagNotFound("origin", "new-tag")
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -356,6 +356,7 @@ var tests = []*components.IntegrationTest{
|
||||
tag.CreateWhileCommitting,
|
||||
tag.CrudAnnotated,
|
||||
tag.CrudLightweight,
|
||||
tag.DeleteLocalAndRemote,
|
||||
tag.ForceTagAnnotated,
|
||||
tag.ForceTagLightweight,
|
||||
tag.Reset,
|
||||
|
||||
Reference in New Issue
Block a user