Skip to content

Commit eae65e7

Browse files
committed
Adding AddCoAuthorTooltip to i18n
- Adding AddCoAuthorTooltip to english lang. - Solved nits in jesseduffield#2912 PR. - Changed add_co_author test to suggested.
1 parent a7ce12f commit eae65e7

File tree

4 files changed

+11
-46
lines changed

4 files changed

+11
-46
lines changed

pkg/commands/git_commands/commit.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ func (self *CommitCommands) AddCoAuthor(sha string, value string) error {
4747

4848
message = message + fmt.Sprintf("\nCo-authored-by: %s", value)
4949

50-
args := []string{"-m", message}
5150
cmdArgs := NewGitCmd("commit").
52-
Arg("--allow-empty", "--amend", "--only").
53-
Arg(args...).
51+
Arg("--allow-empty", "--amend", "--only", "-m", message).
5452
ToArgv()
5553

5654
return self.cmd.New(cmdArgs).Run()

pkg/gui/controllers/local_commits_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ func (self *LocalCommitsController) amendAttribute(commit *models.Commit) error
579579
Label: self.c.Tr.AddCoAuthor,
580580
OnPress: self.addCoAuthor,
581581
Key: 'c',
582-
Tooltip: "Add co-author using the Github/Gitlab metadata Co-authored-by",
582+
Tooltip: self.c.Tr.AddCoAuthorTooltip,
583583
},
584584
},
585585
})

pkg/i18n/english.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type TranslationSet struct {
104104
SetResetCommitAuthor string
105105
SetAuthorPromptTitle string
106106
AddCoAuthorPromptTitle string
107+
AddCoAuthorTooltip string
107108
SureResetCommitAuthor string
108109
RenameCommitEditor string
109110
NoCommitsThisBranch string
@@ -869,6 +870,7 @@ func EnglishTranslationSet() TranslationSet {
869870
SetResetCommitAuthor: "Set/Reset commit author",
870871
SetAuthorPromptTitle: "Set author (must look like 'Name <Email>')",
871872
AddCoAuthorPromptTitle: "Add co-author (must look like 'Name <Email>')",
873+
AddCoAuthorTooltip: "Add co-author using the Github/Gitlab metadata Co-authored-by",
872874
SureResetCommitAuthor: "The author field of this commit will be updated to match the configured user. This also renews the author timestamp. Continue?",
873875
RenameCommitEditor: "Reword commit with editor",
874876
Error: "Error",

pkg/integration/tests/commit/add_co_author.go

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,14 @@ var AddCoAuthor = NewIntegrationTest(NewIntegrationTestArgs{
1111
Skip: false,
1212
SetupConfig: func(config *config.AppConfig) {},
1313
SetupRepo: func(shell *Shell) {
14-
shell.NewBranch("original")
15-
16-
shell.SetConfig("user.email", "[email protected]")
17-
shell.SetConfig("user.name", "Bill Smith")
18-
19-
shell.EmptyCommit("one")
20-
21-
shell.NewBranch("other")
22-
23-
shell.SetConfig("user.email", "[email protected]")
24-
shell.SetConfig("user.name", "John Smith")
25-
26-
shell.EmptyCommit("two")
27-
28-
shell.Checkout("original")
14+
shell.EmptyCommit("initial commit")
2915
},
3016
Run: func(t *TestDriver, keys config.KeybindingConfig) {
3117
t.Views().Commits().
3218
Focus().
3319
Lines(
34-
Contains("BS").Contains("one").IsSelected(),
35-
)
36-
37-
t.Views().Branches().
38-
Focus().
39-
Lines(
40-
Contains("original").IsSelected(),
41-
Contains("other"),
20+
Contains("initial commit").IsSelected(),
4221
).
43-
NavigateToLine(Contains("other")).
44-
PressEnter()
45-
46-
// ensuring we get these commit authors as suggestions
47-
t.Views().SubCommits().
48-
IsFocused().
49-
Lines(
50-
Contains("JS").Contains("two").IsSelected(),
51-
Contains("BS").Contains("one"),
52-
)
53-
54-
t.Views().Commits().
55-
Focus().
5622
Press(keys.Commits.ResetCommitAuthor).
5723
Tap(func() {
5824
t.ExpectPopup().Menu().
@@ -62,14 +28,13 @@ var AddCoAuthor = NewIntegrationTest(NewIntegrationTestArgs{
6228

6329
t.ExpectPopup().Prompt().
6430
Title(Contains("Add co-author")).
65-
SuggestionLines(
66-
Contains("Bill Smith"),
67-
Contains("John Smith"),
68-
).
69-
ConfirmSuggestion(Contains("John Smith"))
31+
Type("John Smith <[email protected]>").
32+
Confirm()
7033
})
34+
7135
t.Views().Main().ContainsLines(
72-
Contains("Co-authored-by"),
36+
Contains("initial commit"),
37+
Contains("Co-authored-by: John Smith <[email protected]>"),
7338
)
7439
},
7540
})

0 commit comments

Comments
 (0)