-
-
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.
Allow user to filter the files view to only show untracked files
This handles the situation where the user's own config says to not show untracked files, as is often the case with bare repos managing a user's dotfiles.
- Loading branch information
1 parent
31e54ea
commit 7e85cdd
Showing
7 changed files
with
100 additions
and
4 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
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
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
62 changes: 62 additions & 0 deletions
62
pkg/integration/tests/filter_and_search/filter_by_file_status.go
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,62 @@ | ||
package filter_and_search | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var FilterByFileStatus = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Filtering to show untracked files in repo that hides them by default", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(config *config.AppConfig) { | ||
}, | ||
SetupRepo: func(shell *Shell) { | ||
// need to set untracked files to not be displayed in git config | ||
shell.SetConfig("status.showUntrackedFiles", "no") | ||
|
||
shell.CreateFileAndAdd("file-tracked", "foo") | ||
|
||
shell.Commit("first commit") | ||
|
||
shell.CreateFile("file-untracked", "bar") | ||
shell.UpdateFile("file-tracked", "baz") | ||
}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Files(). | ||
Focus(). | ||
Lines( | ||
Contains(`file-tracked`).IsSelected(), | ||
). | ||
Press(keys.Files.OpenStatusFilter). | ||
Tap(func() { | ||
t.ExpectPopup().Menu(). | ||
Title(Equals("Filtering")). | ||
Select(Contains("Show only untracked files")). | ||
Confirm() | ||
}). | ||
Lines( | ||
Contains(`file-untracked`).IsSelected(), | ||
). | ||
Press(keys.Files.OpenStatusFilter). | ||
Tap(func() { | ||
t.ExpectPopup().Menu(). | ||
Title(Equals("Filtering")). | ||
Select(Contains("Show only tracked files")). | ||
Confirm() | ||
}). | ||
Lines( | ||
Contains(`file-tracked`).IsSelected(), | ||
). | ||
Press(keys.Files.OpenStatusFilter). | ||
Tap(func() { | ||
t.ExpectPopup().Menu(). | ||
Title(Equals("Filtering")). | ||
Select(Contains("Reset filter")). | ||
Confirm() | ||
}). | ||
Lines( | ||
Contains(`file-tracked`).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