mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-17 00:18:05 +02:00
Changes as per review
This commit is contained in:
committed by
Jesse Duffield
parent
257e222f8d
commit
0c6bdac2f7
@ -462,6 +462,9 @@ func (gui *Gui) handleCommitPick() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleCommitRevert() error {
|
func (gui *Gui) handleCommitRevert() error {
|
||||||
|
if ok, err := gui.validateNotInFilterMode(); err != nil || !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
commit := gui.getSelectedLocalCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
return gui.ask(askOpts{
|
return gui.ask(askOpts{
|
||||||
title: gui.Tr.Actions.RevertCommit,
|
title: gui.Tr.Actions.RevertCommit,
|
||||||
@ -471,9 +474,6 @@ func (gui *Gui) handleCommitRevert() error {
|
|||||||
"selectedCommit": commit.ShortSha(),
|
"selectedCommit": commit.ShortSha(),
|
||||||
}),
|
}),
|
||||||
handleConfirm: func() error {
|
handleConfirm: func() error {
|
||||||
if ok, err := gui.validateNotInFilterMode(); err != nil || !ok {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if commit.IsMerge() {
|
if commit.IsMerge() {
|
||||||
return gui.createRevertMergeCommitMenu(commit)
|
return gui.createRevertMergeCommitMenu(commit)
|
||||||
@ -496,16 +496,30 @@ func (gui *Gui) createRevertMergeCommitMenu(commit *models.Commit) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return gui.surfaceError(err)
|
return gui.surfaceError(err)
|
||||||
}
|
}
|
||||||
|
parentShortSha := utils.SafeTruncate(parentSha, 8)
|
||||||
menuItems[i] = &menuItem{
|
menuItems[i] = &menuItem{
|
||||||
displayString: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message),
|
displayString: fmt.Sprintf("%s: %s", parentShortSha, message),
|
||||||
onPress: func() error {
|
onPress: func() error {
|
||||||
parentNumber := i + 1
|
parentNumber := i + 1
|
||||||
gui.logAction(gui.Tr.Actions.RevertCommit)
|
gui.logAction(gui.Tr.Actions.RevertCommit)
|
||||||
if err := gui.Git.Commit.RevertMerge(commit.Sha, parentNumber); err != nil {
|
gui.ask(askOpts{
|
||||||
return gui.surfaceError(err)
|
title: gui.Tr.SelectParentCommitForMerge,
|
||||||
}
|
prompt: utils.ResolvePlaceholderString(
|
||||||
return gui.afterRevertCommit()
|
"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
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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!",
|
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",
|
LcOpenCommitInBrowser: "open commit in browser",
|
||||||
LcViewBisectOptions: "view bisect options",
|
LcViewBisectOptions: "view bisect options",
|
||||||
ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}? ",
|
ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}?",
|
||||||
Actions: Actions{
|
Actions: Actions{
|
||||||
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
||||||
CheckoutCommit: "Checkout commit",
|
CheckoutCommit: "Checkout commit",
|
||||||
|
Reference in New Issue
Block a user