1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

Changes as per review

This commit is contained in:
glendsoza 2022-01-23 13:16:21 +05:30 committed by Jesse Duffield
parent 257e222f8d
commit 0c6bdac2f7
2 changed files with 24 additions and 10 deletions

View File

@ -462,6 +462,9 @@ func (gui *Gui) handleCommitPick() error {
}
func (gui *Gui) handleCommitRevert() error {
if ok, err := gui.validateNotInFilterMode(); err != nil || !ok {
return err
}
commit := gui.getSelectedLocalCommit()
return gui.ask(askOpts{
title: gui.Tr.Actions.RevertCommit,
@ -471,9 +474,6 @@ func (gui *Gui) handleCommitRevert() error {
"selectedCommit": commit.ShortSha(),
}),
handleConfirm: func() error {
if ok, err := gui.validateNotInFilterMode(); err != nil || !ok {
return err
}
if commit.IsMerge() {
return gui.createRevertMergeCommitMenu(commit)
@ -496,16 +496,30 @@ func (gui *Gui) createRevertMergeCommitMenu(commit *models.Commit) error {
if err != nil {
return gui.surfaceError(err)
}
parentShortSha := utils.SafeTruncate(parentSha, 8)
menuItems[i] = &menuItem{
displayString: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message),
displayString: fmt.Sprintf("%s: %s", parentShortSha, message),
onPress: func() error {
parentNumber := i + 1
gui.logAction(gui.Tr.Actions.RevertCommit)
if err := gui.Git.Commit.RevertMerge(commit.Sha, parentNumber); err != nil {
return gui.surfaceError(err)
}
return gui.afterRevertCommit()
gui.ask(askOpts{
title: gui.Tr.SelectParentCommitForMerge,
prompt: utils.ResolvePlaceholderString(
"Are you sure you want use {{.selectedParentCommit}} as parent commit?",
map[string]string{
"selectedParentCommit": parentShortSha,
}),
handleConfirm: func() error {
if err := gui.Git.Commit.RevertMerge(commit.Sha, parentNumber); err != nil {
return gui.surfaceError(err)
}
return gui.afterRevertCommit()
},
handleClose: func() error {
return gui.pushContext(gui.State.Contexts.Menu)
},
})
return nil
},
}
}

View File

@ -1028,7 +1028,7 @@ func EnglishTranslationSet() TranslationSet {
CantChangeContextSizeError: "Cannot change context while in patch building mode because we were too lazy to support it when releasing the feature. If you really want it, please let us know!",
LcOpenCommitInBrowser: "open commit in browser",
LcViewBisectOptions: "view bisect options",
ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}? ",
ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}?",
Actions: Actions{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
CheckoutCommit: "Checkout commit",