mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 00:26:24 -04:00
Add a test for staging all files when there are none
The stage-all command acts on the whole file tree, and nothing stops it from doing that when the tree is empty. It ends up in the branch that explains why a submodule couldn't be staged, which has nothing to do with what the user did. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c477a2959b
commit
0c04ee5c61
|
|
@ -0,0 +1,28 @@
|
|||
package file
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var StageAllWithoutChangedFiles = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Pressing the stage-all key when there are no changed files says that there are none",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("first commit")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
IsEmpty().
|
||||
Press(keys.Files.ToggleStagedAll).
|
||||
Tap(func() {
|
||||
/* EXPECTED:
|
||||
t.ExpectToast(Contains("No changed files"))
|
||||
ACTUAL: */
|
||||
t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Nothing to stage")).Confirm()
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
@ -248,6 +248,7 @@ var tests = []*components.IntegrationTest{
|
|||
file.RenameSimilarityThresholdChange,
|
||||
file.RenamedFiles,
|
||||
file.RenamedFilesNoRootItem,
|
||||
file.StageAllWithoutChangedFiles,
|
||||
file.StageChildrenRangeSelect,
|
||||
file.StageDeletedRangeSelect,
|
||||
file.StageRangeSelect,
|
||||
|
|
|
|||
Loading…
Reference in a new issue