forked from jesseduffield/lazygit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jesseduffield#2296 from jesseduffield/fix-prompt-r…
…esponse-not-stored
- Loading branch information
Showing
21 changed files
with
124 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
69 changes: 69 additions & 0 deletions
69
pkg/integration/tests/custom_commands/menu_from_commands_output.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,69 @@ | ||
package custom_commands | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Using prompt response in menuFromCommand entries", | ||
ExtraCmdArgs: "", | ||
Skip: false, | ||
SetupRepo: func(shell *Shell) { | ||
shell. | ||
EmptyCommit("foo"). | ||
NewBranch("feature/foo"). | ||
EmptyCommit("bar"). | ||
NewBranch("feature/bar"). | ||
EmptyCommit("baz") | ||
}, | ||
SetupConfig: func(cfg *config.AppConfig) { | ||
cfg.UserConfig.CustomCommands = []config.CustomCommand{ | ||
{ | ||
Key: "a", | ||
Context: "localBranches", | ||
Command: "git checkout {{ index .PromptResponses 1 }}", | ||
Prompts: []config.CustomCommandPrompt{ | ||
{ | ||
Type: "input", | ||
Title: "Which git command do you want to run?", | ||
InitialValue: "branch", | ||
}, | ||
{ | ||
Type: "menuFromCommand", | ||
Title: "Branch:", | ||
Command: `git {{ index .PromptResponses 0 }} --format='%(refname:short)'`, | ||
Filter: "(?P<branch>.*)", | ||
ValueFormat: `{{ .branch }}`, | ||
LabelFormat: `{{ .branch | green }}`, | ||
}, | ||
}, | ||
}, | ||
} | ||
}, | ||
Run: func( | ||
shell *Shell, | ||
input *Input, | ||
assert *Assert, | ||
keys config.KeybindingConfig, | ||
) { | ||
assert.WorkingTreeFileCount(0) | ||
input.SwitchToBranchesWindow() | ||
|
||
input.PressKeys("a") | ||
|
||
assert.InPrompt() | ||
assert.MatchCurrentViewTitle(Equals("Which git command do you want to run?")) | ||
assert.MatchSelectedLine(Equals("branch")) | ||
input.Confirm() | ||
|
||
assert.InMenu() | ||
assert.MatchCurrentViewTitle(Equals("Branch:")) | ||
input.NextItem() | ||
input.NextItem() | ||
assert.MatchSelectedLine(Equals("master")) | ||
input.Confirm() | ||
|
||
assert.CurrentBranchName("master") | ||
}, | ||
}) |
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
1 change: 1 addition & 0 deletions
1
...tion_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/COMMIT_EDITMSG
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 @@ | ||
baz |
Empty file.
1 change: 1 addition & 0 deletions
1
test/integration_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/HEAD
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 @@ | ||
ref: refs/heads/master |
12 changes: 12 additions & 0 deletions
12
.../integration_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/config
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,12 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = false | ||
logallrefupdates = true | ||
[user] | ||
email = [email protected] | ||
name = CI | ||
[commit] | ||
gpgSign = false | ||
[protocol "file"] | ||
allow = always |
1 change: 1 addition & 0 deletions
1
...gration_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/description
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 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
Binary file added
BIN
+65 Bytes
test/integration_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/index
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
...ration_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/info/exclude
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,6 @@ | ||
# git ls-files --others --exclude-from=.git/info/exclude | ||
# Lines that start with '#' are comments. | ||
# For a project mostly in C, the following would be a good set of | ||
# exclude patterns (uncomment them if you want to use them): | ||
# *.[oa] | ||
# *~ |
6 changes: 6 additions & 0 deletions
6
...tegration_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/logs/HEAD
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,6 @@ | ||
0000000000000000000000000000000000000000 44531ed59352b290ebe5d6bebeada267dff76fd5 CI <[email protected]> 1669412559 +0100 commit (initial): foo | ||
44531ed59352b290ebe5d6bebeada267dff76fd5 44531ed59352b290ebe5d6bebeada267dff76fd5 CI <[email protected]> 1669412559 +0100 checkout: moving from master to feature/foo | ||
44531ed59352b290ebe5d6bebeada267dff76fd5 b3518a56dbbd6df36eff0613aea30ab8e6659b26 CI <[email protected]> 1669412559 +0100 commit: bar | ||
b3518a56dbbd6df36eff0613aea30ab8e6659b26 b3518a56dbbd6df36eff0613aea30ab8e6659b26 CI <[email protected]> 1669412559 +0100 checkout: moving from feature/foo to feature/bar | ||
b3518a56dbbd6df36eff0613aea30ab8e6659b26 083b75d86104b3a7d89d9c355719b2aa9113cab9 CI <[email protected]> 1669412559 +0100 commit: baz | ||
083b75d86104b3a7d89d9c355719b2aa9113cab9 44531ed59352b290ebe5d6bebeada267dff76fd5 CI <[email protected]> 1669412567 +0100 checkout: moving from feature/bar to master |
2 changes: 2 additions & 0 deletions
2
...om_commands/menu_from_commands_output/expected/repo/.git_keep/logs/refs/heads/feature/bar
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,2 @@ | ||
0000000000000000000000000000000000000000 b3518a56dbbd6df36eff0613aea30ab8e6659b26 CI <[email protected]> 1669412559 +0100 branch: Created from HEAD | ||
b3518a56dbbd6df36eff0613aea30ab8e6659b26 083b75d86104b3a7d89d9c355719b2aa9113cab9 CI <[email protected]> 1669412559 +0100 commit: baz |
2 changes: 2 additions & 0 deletions
2
...om_commands/menu_from_commands_output/expected/repo/.git_keep/logs/refs/heads/feature/foo
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,2 @@ | ||
0000000000000000000000000000000000000000 44531ed59352b290ebe5d6bebeada267dff76fd5 CI <[email protected]> 1669412559 +0100 branch: Created from HEAD | ||
44531ed59352b290ebe5d6bebeada267dff76fd5 b3518a56dbbd6df36eff0613aea30ab8e6659b26 CI <[email protected]> 1669412559 +0100 commit: bar |
1 change: 1 addition & 0 deletions
1
.../custom_commands/menu_from_commands_output/expected/repo/.git_keep/logs/refs/heads/master
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 @@ | ||
0000000000000000000000000000000000000000 44531ed59352b290ebe5d6bebeada267dff76fd5 CI <[email protected]> 1669412559 +0100 commit (initial): foo |
3 changes: 3 additions & 0 deletions
3
...commands_output/expected/repo/.git_keep/objects/08/3b75d86104b3a7d89d9c355719b2aa9113cab9
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
Binary file added
BIN
+116 Bytes
...commands_output/expected/repo/.git_keep/objects/44/531ed59352b290ebe5d6bebeada267dff76fd5
Binary file not shown.
Binary file added
BIN
+15 Bytes
...commands_output/expected/repo/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
Binary file not shown.
Binary file added
BIN
+146 Bytes
...commands_output/expected/repo/.git_keep/objects/b3/518a56dbbd6df36eff0613aea30ab8e6659b26
Binary file not shown.
1 change: 1 addition & 0 deletions
1
.../custom_commands/menu_from_commands_output/expected/repo/.git_keep/refs/heads/feature/bar
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 @@ | ||
083b75d86104b3a7d89d9c355719b2aa9113cab9 |
1 change: 1 addition & 0 deletions
1
.../custom_commands/menu_from_commands_output/expected/repo/.git_keep/refs/heads/feature/foo
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 @@ | ||
b3518a56dbbd6df36eff0613aea30ab8e6659b26 |
1 change: 1 addition & 0 deletions
1
...n_new/custom_commands/menu_from_commands_output/expected/repo/.git_keep/refs/heads/master
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 @@ | ||
44531ed59352b290ebe5d6bebeada267dff76fd5 |