From eef08f04ecadc57e23ee935689f09317ab42f055 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 30 Oct 2026 21:14:47 +0100 Subject: [PATCH] Don't call the selected commit "current" before bisecting starts After marking the first commit as good or bad, the bisect menu's entries act on the selected commit until git knows both a good and a bad commit. They called it the "current commit" though, as if it was the commit that git wants the user to test. Call it "commit " instead. Co-Authored-By: Claude Opus 5.5 --- pkg/gui/controllers/bisect_controller.go | 16 +++++++++------- pkg/i18n/english.go | 6 ++++++ pkg/integration/tests/bisect/skip.go | 9 --------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go index dc77423a4..b44177536 100644 --- a/pkg/gui/controllers/bisect_controller.go +++ b/pkg/gui/controllers/bisect_controller.go @@ -63,18 +63,20 @@ func (self *BisectController) openMenu(commit *models.Commit) error { // a bad commit yet. Its entries act on the selected commit. func (self *BisectController) openMenuBeforeBisecting(info *git_commands.BisectInfo, commit *models.Commit) error { disabledReason := self.require(self.singleItemSelected())() + ref := utils.ResolvePlaceholderString(self.c.Tr.Bisect.CommitRef, + map[string]string{"hash": commit.ShortHash()}) + markLabel := func(term string) string { + return utils.ResolvePlaceholderString(self.c.Tr.Bisect.MarkRef, + map[string]string{"ref": ref, "term": term}) + } return self.c.Menu(types.CreateMenuOptions{ Title: self.c.Tr.Bisect.BisectMenuTitle, Items: []*types.MenuItem{ - self.markMenuItem( - fmt.Sprintf(self.c.Tr.Bisect.Mark, commit.ShortHash(), info.NewTerm()), - commit.Hash(), info.NewTerm(), disabledReason, 'b'), - self.markMenuItem( - fmt.Sprintf(self.c.Tr.Bisect.Mark, commit.ShortHash(), info.OldTerm()), - commit.Hash(), info.OldTerm(), disabledReason, 'g'), + self.markMenuItem(markLabel(info.NewTerm()), commit.Hash(), info.NewTerm(), disabledReason, 'b'), + self.markMenuItem(markLabel(info.OldTerm()), commit.Hash(), info.OldTerm(), disabledReason, 'g'), self.skipMenuItem( - fmt.Sprintf(self.c.Tr.Bisect.SkipCurrent, commit.ShortHash()), + utils.ResolvePlaceholderString(self.c.Tr.Bisect.SkipRef, map[string]string{"ref": ref}), commit.Hash(), types.KeepCommitSelectionByHash, disabledReason, 's'), self.resetMenuItem(), }, diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index b71d084a6..c4dd71efd 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1048,8 +1048,11 @@ type Bisect struct { NewTermPrompt string BisectMenuTitle string Mark string + MarkRef string SkipCurrent string SkipSelected string + SkipRef string + CommitRef string CompleteTitle string CompletePrompt string CompletePromptIndeterminate string @@ -2374,6 +2377,9 @@ func EnglishTranslationSet() *TranslationSet { MarkStart: "Mark %s as %s (start bisect)", SkipCurrent: "Skip current commit (%s)", SkipSelected: "Skip selected commit (%s)", + MarkRef: "Mark {{.ref}} as {{.term}}", + SkipRef: "Skip {{.ref}}", + CommitRef: "commit {{.hash}}", ResetTitle: "Reset 'git bisect'", ResetPrompt: "Are you sure you want to reset 'git bisect'?", ResetOption: "Reset bisect", diff --git a/pkg/integration/tests/bisect/skip.go b/pkg/integration/tests/bisect/skip.go index d3f92f744..50abe342b 100644 --- a/pkg/integration/tests/bisect/skip.go +++ b/pkg/integration/tests/bisect/skip.go @@ -30,7 +30,6 @@ var Skip = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Menu().Title(Equals("Bisect")). // There's no current commit yet, so the entries act on the // selected commit: - /* EXPECTED: Lines( Contains("b Mark commit").Contains("as bad"), Contains("g Mark commit").Contains("as good"), @@ -38,14 +37,6 @@ var Skip = NewIntegrationTest(NewIntegrationTestArgs{ Contains("r Reset bisect"), Contains("Cancel"), ). - ACTUAL: */ - Lines( - Contains("b Mark current commit").Contains("as bad"), - Contains("g Mark current commit").Contains("as good"), - Contains("s Skip current commit"), - Contains("r Reset bisect"), - Contains("Cancel"), - ). Select(MatchesRegexp(`Mark .* as good`)).Confirm() t.Views().Information().Content(Contains("Bisecting")) }).