-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add commitPrefix for defining a prefix for any project (#3291)
- **PR Description** Adds a new option `git.comitPrefix` to act similarly to `git.commitPrefixes`, except, if defined, it applies to any repo that doesn't have an entry in `git.commitPrefixes`. - **Please check if the PR fulfills these requirements** * [x] 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) * [x] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [x] Docs (specifically `docs/Config.md`) have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
- Loading branch information
Showing
7 changed files
with
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package commit | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var CommitWithGlobalPrefix = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Commit with defined config commitPrefix", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(testConfig *config.AppConfig) { | ||
testConfig.UserConfig.Git.CommitPrefix = &config.CommitPrefixConfig{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "} | ||
}, | ||
SetupRepo: func(shell *Shell) { | ||
shell.NewBranch("feature/TEST-001") | ||
shell.CreateFile("test-commit-prefix", "This is foo bar") | ||
}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Commits(). | ||
IsEmpty() | ||
|
||
t.Views().Files(). | ||
IsFocused(). | ||
PressPrimaryAction(). | ||
Press(keys.Files.CommitChanges) | ||
|
||
t.ExpectPopup().CommitMessagePanel(). | ||
Title(Equals("Commit summary")). | ||
InitialText(Equals("[TEST-001]: ")). | ||
Type("my commit message"). | ||
Cancel() | ||
|
||
t.Views().Files(). | ||
IsFocused(). | ||
Press(keys.Files.CommitChanges) | ||
|
||
t.ExpectPopup().CommitMessagePanel(). | ||
Title(Equals("Commit summary")). | ||
InitialText(Equals("[TEST-001]: my commit message")). | ||
Type(". Added something else"). | ||
Confirm() | ||
|
||
t.Views().Commits().Focus() | ||
t.Views().Main().Content(Contains("[TEST-001]: my commit message. Added something else")) | ||
}, | ||
}) |
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