summaryrefslogtreecommitdiffstats
path: root/pkg/integration
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-22 10:33:40 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-22 10:47:04 +1000
commit3cee37388c8d1688b2c8ff0e5b5509663b096952 (patch)
tree30631f961cbca2f00fe2e094d298d3610a9c3db8 /pkg/integration
parenta7969aef2c0d597ca97f060836233f21b2b68bc6 (diff)
Keep track of authors across local commits and branch commits for suggestions
Previously, we would only show the authors based on local commits, but sometimes you want to set a commit author to that of a commit on another branch. Now, so long as you've viewed the branch's commits, the author will appear as a suggestion.
Diffstat (limited to 'pkg/integration')
-rw-r--r--pkg/integration/tests/commit/set_author.go36
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(),
)
},
})