mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-27 12:32:37 +02:00
Disallow updating non-standard TODO lines when rebasing
This commit is contained in:
parent
f0de880136
commit
41d5f4dbb5
@ -1028,7 +1028,7 @@ func (self *LocalCommitsController) midRebaseCommandEnabled(selectedCommits []*m
|
|||||||
return &types.DisabledReason{Text: self.c.Tr.MustSelectTodoCommits}
|
return &types.DisabledReason{Text: self.c.Tr.MustSelectTodoCommits}
|
||||||
}
|
}
|
||||||
|
|
||||||
if commit.Action == models.ActionConflict {
|
if !isChangeOfRebaseTodoAllowed(commit.Action) {
|
||||||
return &types.DisabledReason{Text: self.c.Tr.ChangingThisActionIsNotAllowed}
|
return &types.DisabledReason{Text: self.c.Tr.ChangingThisActionIsNotAllowed}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1036,6 +1036,24 @@ func (self *LocalCommitsController) midRebaseCommandEnabled(selectedCommits []*m
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These actions represent standard things you might want to do with a commit,
|
||||||
|
// as opposed to TODO actions like 'merge', 'update-ref', etc.
|
||||||
|
var standardActions = []todo.TodoCommand{
|
||||||
|
todo.Pick,
|
||||||
|
todo.Drop,
|
||||||
|
todo.Edit,
|
||||||
|
todo.Fixup,
|
||||||
|
todo.Squash,
|
||||||
|
todo.Reword,
|
||||||
|
}
|
||||||
|
|
||||||
|
func isChangeOfRebaseTodoAllowed(oldAction todo.TodoCommand) bool {
|
||||||
|
// Only allow updating a standard action, meaning we disallow
|
||||||
|
// updating a merge commit or update ref commit (until we decide what would be sensible
|
||||||
|
// to do in those cases)
|
||||||
|
return lo.Contains(standardActions, oldAction)
|
||||||
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) pickEnabled(selectedCommits []*models.Commit, startIdx int, endIdx int) *types.DisabledReason {
|
func (self *LocalCommitsController) pickEnabled(selectedCommits []*models.Commit, startIdx int, endIdx int) *types.DisabledReason {
|
||||||
if !self.isRebasing() {
|
if !self.isRebasing() {
|
||||||
// if not rebasing, we're going to do a pull so we don't care about the selection
|
// if not rebasing, we're going to do a pull so we don't care about the selection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user