mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
Support range select for staging/discarding files
As part of this, you must now press enter on a merge conflict file to focus the merge view; you can no longer press space and if you do it will raise an error.
This commit is contained in:
70
pkg/integration/tests/file/discard_various_changes.go
Normal file
70
pkg/integration/tests/file/discard_various_changes.go
Normal file
@@ -0,0 +1,70 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var DiscardVariousChanges = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Discarding all possible permutations of changed files",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
createAllPossiblePermutationsOfChangedFiles(shell)
|
||||
},
|
||||
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
type statusFile struct {
|
||||
status string
|
||||
label string
|
||||
}
|
||||
|
||||
discardOneByOne := func(files []statusFile) {
|
||||
for _, file := range files {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
SelectedLine(Contains(file.status + " " + file.label)).
|
||||
Press(keys.Universal.Remove)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Discard changes")).
|
||||
Select(Contains("Discard all changes")).
|
||||
Confirm()
|
||||
}
|
||||
}
|
||||
|
||||
discardOneByOne([]statusFile{
|
||||
{status: "UA", label: "added-them-changed-us.txt"},
|
||||
{status: "AA", label: "both-added.txt"},
|
||||
{status: "DD", label: "both-deleted.txt"},
|
||||
{status: "UU", label: "both-modded.txt"},
|
||||
{status: "AU", label: "changed-them-added-us.txt"},
|
||||
{status: "UD", label: "deleted-them.txt"},
|
||||
{status: "DU", label: "deleted-us.txt"},
|
||||
})
|
||||
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Continue")).
|
||||
Content(Contains("All merge conflicts resolved. Continue?")).
|
||||
Cancel()
|
||||
|
||||
discardOneByOne([]statusFile{
|
||||
{status: "AM", label: "added-changed.txt"},
|
||||
{status: "MD", label: "change-delete.txt"},
|
||||
{status: "D ", label: "delete-change.txt"},
|
||||
{status: "D ", label: "deleted-staged.txt"},
|
||||
{status: " D", label: "deleted.txt"},
|
||||
{status: "MM", label: "double-modded.txt"},
|
||||
{status: "M ", label: "modded-staged.txt"},
|
||||
{status: " M", label: "modded.txt"},
|
||||
{status: "A ", label: "new-staged.txt"},
|
||||
{status: "??", label: "new.txt"},
|
||||
// the menu title only includes the new file
|
||||
{status: "R ", label: "renamed.txt → renamed2.txt"},
|
||||
})
|
||||
|
||||
t.Views().Files().IsEmpty()
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user