mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-17 12:06:38 +02:00
Merge pull request #2629 from jesseduffield/try-fix-conflict-continue-prompt
This commit is contained in:
commit
ea5fb6a364
@ -30,6 +30,7 @@ func (gui *Gui) LogAction(action string) {
|
|||||||
|
|
||||||
gui.Views.Extras.Autoscroll = true
|
gui.Views.Extras.Autoscroll = true
|
||||||
|
|
||||||
|
gui.GuiLog = append(gui.GuiLog, action)
|
||||||
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(action))
|
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(action))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ func (gui *Gui) LogCommand(cmdStr string, commandLine bool) {
|
|||||||
// we style it differently to communicate that
|
// we style it differently to communicate that
|
||||||
textStyle = style.FgMagenta
|
textStyle = style.FgMagenta
|
||||||
}
|
}
|
||||||
gui.CmdLog = append(gui.CmdLog, cmdStr)
|
gui.GuiLog = append(gui.GuiLog, cmdStr)
|
||||||
indentedCmdStr := " " + strings.Replace(cmdStr, "\n", "\n ", -1)
|
indentedCmdStr := " " + strings.Replace(cmdStr, "\n", "\n ", -1)
|
||||||
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
|
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ func (self *ContextMgr) pushToContextStack(c types.Context) ([]types.Context, ty
|
|||||||
defer self.Unlock()
|
defer self.Unlock()
|
||||||
|
|
||||||
if len(self.ContextStack) > 0 &&
|
if len(self.ContextStack) > 0 &&
|
||||||
c == self.ContextStack[len(self.ContextStack)-1] {
|
c.GetKey() == self.ContextStack[len(self.ContextStack)-1].GetKey() {
|
||||||
// Context being pushed is already on top of the stack: nothing to
|
// Context being pushed is already on top of the stack: nothing to
|
||||||
// deactivate or activate
|
// deactivate or activate
|
||||||
return contextsToDeactivate, nil
|
return contextsToDeactivate, nil
|
||||||
@ -105,7 +105,9 @@ func (self *ContextMgr) pushToContextStack(c types.Context) ([]types.Context, ty
|
|||||||
self.ContextStack = append(self.ContextStack, c)
|
self.ContextStack = append(self.ContextStack, c)
|
||||||
} else if c.GetKind() == types.SIDE_CONTEXT {
|
} else if c.GetKind() == types.SIDE_CONTEXT {
|
||||||
// if we are switching to a side context, remove all other contexts in the stack
|
// if we are switching to a side context, remove all other contexts in the stack
|
||||||
contextsToDeactivate = self.ContextStack
|
contextsToDeactivate = lo.Filter(self.ContextStack, func(context types.Context, _ int) bool {
|
||||||
|
return context.GetKey() != c.GetKey()
|
||||||
|
})
|
||||||
self.ContextStack = []types.Context{c}
|
self.ContextStack = []types.Context{c}
|
||||||
} else if c.GetKind() == types.MAIN_CONTEXT {
|
} else if c.GetKind() == types.MAIN_CONTEXT {
|
||||||
// if we're switching to a main context, remove all other main contexts in the stack
|
// if we're switching to a main context, remove all other main contexts in the stack
|
||||||
|
@ -56,7 +56,15 @@ func (self *MergeConflictsHelper) EscapeMerge() error {
|
|||||||
|
|
||||||
// doing this in separate UI thread so that we're not still holding the lock by the time refresh the file
|
// doing this in separate UI thread so that we're not still holding the lock by the time refresh the file
|
||||||
self.c.OnUIThread(func() error {
|
self.c.OnUIThread(func() error {
|
||||||
|
// There is a race condition here: refreshing the files scope can trigger the
|
||||||
|
// confirmation context to be pushed if all conflicts are resolved (prompting
|
||||||
|
// to continue the merge/rebase. In that case, we don't want to then push the
|
||||||
|
// files context over it.
|
||||||
|
// So long as both places call OnUIThread, we're fine.
|
||||||
|
if self.c.IsCurrentContext(self.c.Contexts().MergeConflicts) {
|
||||||
return self.c.PushContext(self.c.Contexts().Files)
|
return self.c.PushContext(self.c.Contexts().Files)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -93,8 +93,8 @@ type Gui struct {
|
|||||||
|
|
||||||
Views types.Views
|
Views types.Views
|
||||||
|
|
||||||
// Log of the commands that get run, to be displayed to the user.
|
// Log of the commands/actions logged in the Command Log panel.
|
||||||
CmdLog []string
|
GuiLog []string
|
||||||
|
|
||||||
// the extras window contains things like the command log
|
// the extras window contains things like the command log
|
||||||
ShowExtrasWindow bool
|
ShowExtrasWindow bool
|
||||||
@ -440,7 +440,7 @@ func NewGui(
|
|||||||
showRecentRepos: showRecentRepos,
|
showRecentRepos: showRecentRepos,
|
||||||
RepoPathStack: &utils.StringStack{},
|
RepoPathStack: &utils.StringStack{},
|
||||||
RepoStateMap: map[Repo]*GuiRepoState{},
|
RepoStateMap: map[Repo]*GuiRepoState{},
|
||||||
CmdLog: []string{},
|
GuiLog: []string{},
|
||||||
|
|
||||||
// originally we could only hide the command log permanently via the config
|
// originally we could only hide the command log permanently via the config
|
||||||
// but now we do it via state. So we need to still support the config for the
|
// but now we do it via state. So we need to still support the config for the
|
||||||
|
@ -64,7 +64,7 @@ func (self *GuiDriver) Fail(message string) {
|
|||||||
"%s\nFinal Lazygit state:\n%s\nUpon failure, focused view was '%s'.\nLog:\n%s", message,
|
"%s\nFinal Lazygit state:\n%s\nUpon failure, focused view was '%s'.\nLog:\n%s", message,
|
||||||
self.gui.g.Snapshot(),
|
self.gui.g.Snapshot(),
|
||||||
currentView.Name(),
|
currentView.Name(),
|
||||||
strings.Join(self.gui.CmdLog, "\n"),
|
strings.Join(self.gui.GuiLog, "\n"),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.gui.g.Close()
|
self.gui.g.Close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user