mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-01 00:54:58 +02:00
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.
This commit is contained in:
@ -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(),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user