Skip to content

Commit 6951ff6

Browse files
committed
Add number of commits to cherry-pick message
1 parent d11e11d commit 6951ff6

File tree

8 files changed

+15
-8
lines changed

8 files changed

+15
-8
lines changed

pkg/gui/controllers/helpers/cherry_pick_helper.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package helpers
22

33
import (
4+
"strconv"
5+
46
"github.com/jesseduffield/gocui"
57
"github.com/jesseduffield/lazygit/pkg/commands/models"
68
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
79
"github.com/jesseduffield/lazygit/pkg/gui/types"
10+
"github.com/jesseduffield/lazygit/pkg/utils"
811
"github.com/samber/lo"
912
)
1013

@@ -65,7 +68,11 @@ func (self *CherryPickHelper) CopyRange(commitsList []*models.Commit, context ty
6568
func (self *CherryPickHelper) Paste() error {
6669
self.c.Confirm(types.ConfirmOpts{
6770
Title: self.c.Tr.CherryPick,
68-
Prompt: self.c.Tr.SureCherryPick,
71+
Prompt: utils.ResolvePlaceholderString(
72+
self.c.Tr.SureCherryPick,
73+
map[string]string{
74+
"numCommits": strconv.Itoa(len(self.getData().CherryPickedCommits)),
75+
}),
6976
HandleConfirm: func() error {
7077
isInRebase, err := self.c.Git().Status.IsInInteractiveRebase()
7178
if err != nil {

pkg/i18n/english.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ func EnglishTranslationSet() *TranslationSet {
13101310
CherryPickCopyTooltip: "Mark commit as copied. Then, within the local commits view, you can press `{{.paste}}` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `{{.escape}}` to cancel the selection.",
13111311
CherryPickCopyRangeTooltip: "Mark commits as copied from the last copied commit to the selected commit.",
13121312
PasteCommits: "Paste (cherry-pick)",
1313-
SureCherryPick: "Are you sure you want to cherry-pick the copied commits onto this branch?",
1313+
SureCherryPick: "Are you sure you want to cherry-pick the {{.numCommits}} copied commit(s) onto this branch?",
13141314
CherryPick: "Cherry-pick",
13151315
CannotCherryPickNonCommit: "Cannot cherry-pick this kind of todo item",
13161316
CannotCherryPickMergeCommit: "Cherry-picking merge commits is not supported",

pkg/integration/tests/cherry_pick/cherry_pick.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
6666
Tap(func() {
6767
t.ExpectPopup().Alert().
6868
Title(Equals("Cherry-pick")).
69-
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
69+
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
7070
Confirm()
7171
}).
7272
Tap(func() {

pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
4949

5050
t.ExpectPopup().Alert().
5151
Title(Equals("Cherry-pick")).
52-
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
52+
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
5353
Confirm()
5454

5555
t.Common().AcknowledgeConflicts()

pkg/integration/tests/cherry_pick/cherry_pick_during_rebase.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var CherryPickDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
6767
Tap(func() {
6868
t.ExpectPopup().Alert().
6969
Title(Equals("Cherry-pick")).
70-
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
70+
Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")).
7171
Confirm()
7272
}).
7373
Tap(func() {

pkg/integration/tests/cherry_pick/cherry_pick_range.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var CherryPickRange = NewIntegrationTest(NewIntegrationTestArgs{
6363
Tap(func() {
6464
t.ExpectPopup().Alert().
6565
Title(Equals("Cherry-pick")).
66-
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
66+
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
6767
Confirm()
6868
}).
6969
Tap(func() {

pkg/integration/tests/demo/cherry_pick.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
7171
t.Wait(1000)
7272
t.ExpectPopup().Alert().
7373
Title(Equals("Cherry-pick")).
74-
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
74+
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
7575
Confirm()
7676
}).
7777
TopLines(

pkg/integration/tests/reflog/cherry_pick.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
3939
Tap(func() {
4040
t.ExpectPopup().Alert().
4141
Title(Equals("Cherry-pick")).
42-
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
42+
Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")).
4343
Confirm()
4444
}).
4545
Lines(

0 commit comments

Comments
 (0)