1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

Add coauthor (#2)

Add co-author to commits

Add addCoAuthor command for commits

- Implement the `addCoAuthor` command to add co-authors to commits.
- Utilize suggestions helpers to populate author names from the suggestions list.
- Added command to gui at `LocalCommitsController`.

This commit introduces the `addCoAuthor` command, which allows users to easily add co-authors to their commits. The co-author names are populated from the suggestions list, minimizing the chances of user input errors. The co-authors are added using the Co-authored-by metadata format recognized by GitHub and GitLab.
This commit is contained in:
Orlando Maussa
2023-09-09 07:18:47 -05:00
committed by GitHub
parent d7e2ca3f10
commit db409fa69f
6 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,40 @@
package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddCoAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add co-author on a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("initial commit").IsSelected(),
).
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains("Add co-author")).
Confirm()
t.ExpectPopup().Prompt().
Title(Contains("Add co-author")).
Type("John Smith <jsmith@gmail.com>").
Confirm()
})
t.Views().Main().ContainsLines(
Contains("initial commit"),
Contains("Co-authored-by: John Smith <jsmith@gmail.com>"),
)
},
})