diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-22 11:00:38 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 11:00:38 +1000 |
commit | 084c0a19bcb72db7108e692d186e5b6c64440ed4 (patch) | |
tree | 30631f961cbca2f00fe2e094d298d3610a9c3db8 /pkg/integration | |
parent | a7969aef2c0d597ca97f060836233f21b2b68bc6 (diff) | |
parent | 3cee37388c8d1688b2c8ff0e5b5509663b096952 (diff) |
Include more commit authors in author suggestions (#2807)
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/tests/commit/set_author.go | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/pkg/integration/tests/commit/set_author.go b/pkg/integration/tests/commit/set_author.go index ecfc201fd..e0cd722da 100644 --- a/pkg/integration/tests/commit/set_author.go +++ b/pkg/integration/tests/commit/set_author.go @@ -5,29 +5,58 @@ import ( . "github.com/jesseduffield/lazygit/pkg/integration/components" ) +// Originally we only suggested authors present in the current branch, but now +// we include authors from other branches whose commits you've looked at in the +// lazygit session. + var SetAuthor = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Set author on a commit", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { + shell.NewBranch("original") + shell.SetConfig("user.email", "Bill@example.com") shell.SetConfig("user.name", "Bill Smith") shell.EmptyCommit("one") + shell.NewBranch("other") + shell.SetConfig("user.email", "John@example.com") shell.SetConfig("user.name", "John Smith") shell.EmptyCommit("two") + + shell.Checkout("original") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( + Contains("BS").Contains("one").IsSelected(), + ) + + t.Views().Branches(). + Focus(). + Lines( + Contains("original").IsSelected(), + Contains("other"), + ). + NavigateToLine(Contains("other")). + PressEnter() + + // ensuring we get these commit authors as suggestions + t.Views().SubCommits(). + IsFocused(). + Lines( Contains("JS").Contains("two").IsSelected(), Contains("BS").Contains("one"), - ). + ) + + t.Views().Commits(). + Focus(). Press(keys.Commits.ResetCommitAuthor). Tap(func() { t.ExpectPopup().Menu(). @@ -38,14 +67,13 @@ var SetAuthor = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Prompt(). Title(Contains("Set author")). SuggestionLines( - Contains("John Smith"), Contains("Bill Smith"), + Contains("John Smith"), ). ConfirmSuggestion(Contains("John Smith")) }). Lines( - Contains("JS").Contains("two").IsSelected(), - Contains("BS").Contains("one"), + Contains("JS").Contains("one").IsSelected(), ) }, }) |