mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 21:05:48 +02:00
feat: support range selection for commit attributes amend
This commit is contained in:
parent
92f13fc56e
commit
6b9cf72e79
6 changed files with 282 additions and 42 deletions
57
pkg/integration/tests/commit/set_author_range.go
Normal file
57
pkg/integration/tests/commit/set_author_range.go
Normal file
|
@ -0,0 +1,57 @@
|
|||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var SetAuthorRange = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Set author on a range of commits",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.SetConfig("user.email", "Bill@example.com")
|
||||
shell.SetConfig("user.name", "Bill Smith")
|
||||
|
||||
shell.EmptyCommit("fourth")
|
||||
shell.EmptyCommit("third")
|
||||
shell.EmptyCommit("second")
|
||||
shell.EmptyCommit("first")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("BS").Contains("first").IsSelected(),
|
||||
Contains("BS").Contains("second"),
|
||||
Contains("BS").Contains("third"),
|
||||
Contains("BS").Contains("fourth"),
|
||||
)
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
SelectNextItem().
|
||||
Press(keys.Universal.ToggleRangeSelect).
|
||||
SelectNextItem().
|
||||
Press(keys.Commits.ResetCommitAuthor).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Amend commit attribute")).
|
||||
Select(Contains(" Set author")). // adding space at start to distinguish from 'reset author'
|
||||
Confirm()
|
||||
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Contains("Set author")).
|
||||
Type("John Smith <John@example.com>").
|
||||
Confirm()
|
||||
}).
|
||||
PressEscape().
|
||||
Lines(
|
||||
Contains("BS").Contains("first"),
|
||||
Contains("JS").Contains("second"),
|
||||
Contains("JS").Contains("third").IsSelected(),
|
||||
Contains("BS").Contains("fourth"),
|
||||
)
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue