-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix range select -> stage failure when deleted file is already staged (…
…#3631) - **PR Description** Fix range select -> stage failure when deleted file is already staged. Fixes #3603 - **Please check if the PR fulfills these requirements** * [ ] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [ ] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [ ] Docs have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc <!-- Be sure to name your PR with an imperative e.g. 'Add worktrees view' see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for examples -->
- Loading branch information
Showing
3 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package file | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var StageDeletedRangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Stage a range of deleted files using range select", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(config *config.AppConfig) { | ||
}, | ||
SetupRepo: func(shell *Shell) { | ||
shell.CreateFileAndAdd("file-a", "") | ||
shell.CreateFileAndAdd("file-b", "") | ||
shell.Commit("first commit") | ||
|
||
shell.DeleteFile("file-a") | ||
shell.DeleteFile("file-b") | ||
}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Files(). | ||
IsFocused(). | ||
Lines( | ||
Contains(" D").Contains("file-a").IsSelected(), | ||
Contains(" D").Contains("file-b"), | ||
). | ||
// Stage a single deleted file | ||
PressPrimaryAction(). | ||
Lines( | ||
Contains("D ").Contains("file-a").IsSelected(), | ||
Contains(" D").Contains("file-b"), | ||
). | ||
Press(keys.Universal.ToggleRangeSelect). | ||
NavigateToLine(Contains("file-b")). | ||
// Stage both files while a deleted file is already staged | ||
PressPrimaryAction(). | ||
Lines( | ||
Contains("D ").Contains("file-a").IsSelected(), | ||
Contains("D ").Contains("file-b").IsSelected(), | ||
). | ||
// Unstage; back to everything being unstaged | ||
PressPrimaryAction(). | ||
Lines( | ||
Contains(" D").Contains("file-a").IsSelected(), | ||
Contains(" D").Contains("file-b").IsSelected(), | ||
) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters