mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-04 23:37:41 +02:00
Show update-ref commands in rebase todo list
This is useful when working with stacked branches, because you can now move "pick" entries across an update-ref command and you can tell exactly which branch the commit will end up in. It's also useful to spot situations where the --update-refs option didn't work as desired. For example, if you duplicate a branch and want to rebase only one of the branches but not the other (maybe for testing); if you have rebase.updateRefs=true in your git config, then rebasing one branch will move the other branch along. To solve this we'll have to introduce a way to delete the update-ref entry (maybe by hitting backspace?); this is out of scope for this PR, so for now users will have to type "git rebase --edit-todo" into the custom command prompt to sort this out. We will also have to prevent users from trying to turn update-ref commands into other commands like "pick" or "drop"; we'll do this later in this branch.
This commit is contained in:
parent
740474c10c
commit
227b0b781c
@ -311,7 +311,9 @@ func (self *CommitLoader) getInteractiveRebasingCommits() ([]*models.Commit, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range todos {
|
for _, t := range todos {
|
||||||
if t.Commit == "" {
|
if t.Command == todo.UpdateRef {
|
||||||
|
t.Msg = strings.TrimPrefix(t.Ref, "refs/heads/")
|
||||||
|
} else if t.Commit == "" {
|
||||||
// Command does not have a commit associated, skip
|
// Command does not have a commit associated, skip
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package gui
|
package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/fsmiamoto/git-todo-parser/todo"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
@ -34,6 +35,13 @@ func (gui *Gui) branchCommitsRenderToMain() error {
|
|||||||
commit := gui.State.Contexts.LocalCommits.GetSelected()
|
commit := gui.State.Contexts.LocalCommits.GetSelected()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
task = types.NewRenderStringTask(gui.c.Tr.NoCommitsThisBranch)
|
task = types.NewRenderStringTask(gui.c.Tr.NoCommitsThisBranch)
|
||||||
|
} else if commit.Action == todo.UpdateRef {
|
||||||
|
task = types.NewRenderStringTask(
|
||||||
|
utils.ResolvePlaceholderString(
|
||||||
|
gui.c.Tr.UpdateRefHere,
|
||||||
|
map[string]string{
|
||||||
|
"ref": commit.Name,
|
||||||
|
}))
|
||||||
} else {
|
} else {
|
||||||
cmdObj := gui.git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath(),
|
cmdObj := gui.git.Commit.ShowCmdObj(commit.Sha, gui.State.Modes.Filtering.GetPath(),
|
||||||
gui.IgnoreWhitespaceInDiffView)
|
gui.IgnoreWhitespaceInDiffView)
|
||||||
|
@ -347,7 +347,7 @@ func getShaColor(
|
|||||||
return getBisectStatusColor(bisectStatus)
|
return getBisectStatusColor(bisectStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
diffed := commit.Sha == diffName
|
diffed := commit.Sha != "" && commit.Sha == diffName
|
||||||
shaColor := theme.DefaultTextColor
|
shaColor := theme.DefaultTextColor
|
||||||
switch commit.Status {
|
switch commit.Status {
|
||||||
case models.StatusUnpushed:
|
case models.StatusUnpushed:
|
||||||
|
@ -105,6 +105,7 @@ type TranslationSet struct {
|
|||||||
SureResetCommitAuthor string
|
SureResetCommitAuthor string
|
||||||
LcRenameCommitEditor string
|
LcRenameCommitEditor string
|
||||||
NoCommitsThisBranch string
|
NoCommitsThisBranch string
|
||||||
|
UpdateRefHere string
|
||||||
Error string
|
Error string
|
||||||
LcSelectHunk string
|
LcSelectHunk string
|
||||||
LcNavigateConflicts string
|
LcNavigateConflicts string
|
||||||
@ -754,6 +755,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
LcSquashDown: "squash down",
|
LcSquashDown: "squash down",
|
||||||
LcFixupCommit: "fixup commit",
|
LcFixupCommit: "fixup commit",
|
||||||
NoCommitsThisBranch: "No commits for this branch",
|
NoCommitsThisBranch: "No commits for this branch",
|
||||||
|
UpdateRefHere: "Update branch '{{.ref}}' here",
|
||||||
CannotSquashOrFixupFirstCommit: "There's no commit below to squash into",
|
CannotSquashOrFixupFirstCommit: "There's no commit below to squash into",
|
||||||
Fixup: "Fixup",
|
Fixup: "Fixup",
|
||||||
SureFixupThisCommit: "Are you sure you want to 'fixup' this commit? It will be merged into the commit below",
|
SureFixupThisCommit: "Are you sure you want to 'fixup' this commit? It will be merged into the commit below",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user