mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
WIP
This commit is contained in:
parent
ae1c4536e6
commit
6c270b6e26
@ -19,8 +19,13 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (gui *Gui) findConflicts(content string) ([]commands.Conflict, error) {
|
func (gui *Gui) findConflicts(content string) []commands.Conflict {
|
||||||
conflicts := make([]commands.Conflict, 0)
|
conflicts := make([]commands.Conflict, 0)
|
||||||
|
|
||||||
|
if content == "" {
|
||||||
|
return conflicts
|
||||||
|
}
|
||||||
|
|
||||||
var newConflict commands.Conflict
|
var newConflict commands.Conflict
|
||||||
for i, line := range utils.SplitLines(content) {
|
for i, line := range utils.SplitLines(content) {
|
||||||
trimmedLine := strings.TrimPrefix(line, "++")
|
trimmedLine := strings.TrimPrefix(line, "++")
|
||||||
@ -34,7 +39,7 @@ func (gui *Gui) findConflicts(content string) ([]commands.Conflict, error) {
|
|||||||
conflicts = append(conflicts, newConflict)
|
conflicts = append(conflicts, newConflict)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conflicts, nil
|
return conflicts
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) shiftConflict(conflicts []commands.Conflict) (commands.Conflict, []commands.Conflict) {
|
func (gui *Gui) shiftConflict(conflicts []commands.Conflict) (commands.Conflict, []commands.Conflict) {
|
||||||
@ -211,16 +216,16 @@ func (gui *Gui) refreshMergePanel() error {
|
|||||||
panelState := gui.State.Panels.Merging
|
panelState := gui.State.Panels.Merging
|
||||||
cat, err := gui.catSelectedFile(gui.g)
|
cat, err := gui.catSelectedFile(gui.g)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return gui.refreshMain(refreshMainOpts{
|
||||||
}
|
main: &viewUpdateOpts{
|
||||||
if cat == "" {
|
title: "",
|
||||||
return nil
|
task: gui.createRenderStringTask(err.Error()),
|
||||||
}
|
},
|
||||||
panelState.Conflicts, err = gui.findConflicts(cat)
|
})
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
panelState.Conflicts = gui.findConflicts(cat)
|
||||||
|
|
||||||
// handle potential fixes that the user made in their editor since we last refreshed
|
// handle potential fixes that the user made in their editor since we last refreshed
|
||||||
if len(panelState.Conflicts) == 0 {
|
if len(panelState.Conflicts) == 0 {
|
||||||
return gui.handleCompleteMerge()
|
return gui.handleCompleteMerge()
|
||||||
|
@ -26,23 +26,23 @@ func (gui *Gui) handleStashEntrySelect() error {
|
|||||||
return gui.renderDiff()
|
return gui.renderDiff()
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.splitMainPanel(false)
|
var task updateTask
|
||||||
|
|
||||||
gui.getMainView().Title = "Stash"
|
|
||||||
|
|
||||||
stashEntry := gui.getSelectedStashEntry()
|
stashEntry := gui.getSelectedStashEntry()
|
||||||
if stashEntry == nil {
|
if stashEntry == nil {
|
||||||
return gui.newStringTask("main", gui.Tr.SLocalize("NoStashEntries"))
|
task = gui.createRenderStringTask(gui.Tr.SLocalize("NoStashEntries"))
|
||||||
|
} else {
|
||||||
|
cmd := gui.OSCommand.ExecutableFromString(
|
||||||
|
gui.GitCommand.ShowStashEntryCmdStr(stashEntry.Index),
|
||||||
|
)
|
||||||
|
task = gui.createRunPtyTask(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := gui.OSCommand.ExecutableFromString(
|
return gui.refreshMain(refreshMainOpts{
|
||||||
gui.GitCommand.ShowStashEntryCmdStr(stashEntry.Index),
|
main: &viewUpdateOpts{
|
||||||
)
|
title: "Stash",
|
||||||
if err := gui.newPtyTask("main", cmd); err != nil {
|
task: task,
|
||||||
gui.Log.Error(err)
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) refreshStashEntries(g *gocui.Gui) error {
|
func (gui *Gui) refreshStashEntries(g *gocui.Gui) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user