diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-07-24 12:29:42 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-07-31 11:38:52 +0200 |
commit | d41a195ee6202b5754ba0e996f67a18675b85302 (patch) | |
tree | 1061fa26233c7efbfdf046b0715ccf191e5f271c /pkg/integration | |
parent | 71d2fd37e2ff8214d5af3135ab3a355971789dc2 (diff) |
Allow force-tagging if tag exists
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/tests/tag/force_tag_annotated.go | 47 | ||||
-rw-r--r-- | pkg/integration/tests/tag/force_tag_lightweight.go | 43 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 2 |
3 files changed, 92 insertions, 0 deletions
diff --git a/pkg/integration/tests/tag/force_tag_annotated.go b/pkg/integration/tests/tag/force_tag_annotated.go new file mode 100644 index 000000000..1f9e2f09b --- /dev/null +++ b/pkg/integration/tests/tag/force_tag_annotated.go @@ -0,0 +1,47 @@ +package tag + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var ForceTagAnnotated = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Overwrite an annotated tag that already exists", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("first commit") + shell.CreateAnnotatedTag("new-tag", "message", "HEAD") + shell.EmptyCommit("second commit") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Lines( + Contains("second commit").IsSelected(), + Contains("new-tag").Contains("first commit"), + ). + Press(keys.Commits.CreateTag). + Tap(func() { + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). + Type("new-tag"). + SwitchToDescription(). + Title(Equals("Tag description")). + Type("message"). + SwitchToSummary(). + Confirm() + }). + Tap(func() { + t.ExpectPopup().Confirmation(). + Title(Equals("Force Tag")). + Content(Contains("The tag 'new-tag' exists already. Press <esc> to cancel, or <enter> to overwrite.")). + Confirm() + }). + Lines( + Contains("new-tag").Contains("second commit"), + DoesNotContain("new-tag").Contains("first commit"), + ) + }, +}) diff --git a/pkg/integration/tests/tag/force_tag_lightweight.go b/pkg/integration/tests/tag/force_tag_lightweight.go new file mode 100644 index 000000000..1f24b624c --- /dev/null +++ b/pkg/integration/tests/tag/force_tag_lightweight.go @@ -0,0 +1,43 @@ +package tag + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var ForceTagLightweight = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Overwrite a lightweight tag that already exists", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("first commit") + shell.CreateLightweightTag("new-tag", "HEAD") + shell.EmptyCommit("second commit") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Lines( + Contains("second commit").IsSelected(), + Contains("new-tag").Contains("first commit"), + ). + Press(keys.Commits.CreateTag). + Tap(func() { + t.ExpectPopup().CommitMessagePanel(). + Title(Equals("Tag name")). + Type("new-tag"). + Confirm() + }). + Tap(func() { + t.ExpectPopup().Confirmation(). + Title(Equals("Force Tag")). + Content(Contains("The tag 'new-tag' exists already. Press <esc> to cancel, or <enter> to overwrite.")). + Confirm() + }). + Lines( + Contains("new-tag").Contains("second commit"), + DoesNotContain("new-tag").Contains("first commit"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index dfcd6c0ea..d7870ff49 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -214,6 +214,8 @@ var tests = []*components.IntegrationTest{ tag.CreateWhileCommitting, tag.CrudAnnotated, tag.CrudLightweight, + tag.ForceTagAnnotated, + tag.ForceTagLightweight, tag.Reset, ui.Accordion, ui.DoublePopup, |