mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-10 04:07:18 +02:00
in fact we don't need any of these options
This commit is contained in:
parent
919463ff02
commit
036b53acf8
@ -1116,13 +1116,9 @@ func (c *GitCommand) FetchRemote(remoteName string) error {
|
||||
return c.OSCommand.RunCommand("git fetch %s", remoteName)
|
||||
}
|
||||
|
||||
type GetReflogCommitsOptions struct {
|
||||
Recycle bool
|
||||
}
|
||||
|
||||
// GetReflogCommits only returns the new reflog commits since the given lastReflogCommit
|
||||
// if none is passed (i.e. it's value is nil) then we get all the reflog commits
|
||||
func (c *GitCommand) GetReflogCommits(lastReflogCommit *Commit, options GetReflogCommitsOptions) ([]*Commit, bool, error) {
|
||||
func (c *GitCommand) GetReflogCommits(lastReflogCommit *Commit) ([]*Commit, bool, error) {
|
||||
commits := make([]*Commit, 0)
|
||||
re := regexp.MustCompile(`(\w+).*HEAD@\{([^\}]+)\}: (.*)`)
|
||||
|
||||
@ -1143,7 +1139,7 @@ func (c *GitCommand) GetReflogCommits(lastReflogCommit *Commit, options GetReflo
|
||||
Status: "reflog",
|
||||
}
|
||||
|
||||
if options.Recycle && lastReflogCommit != nil && commit.Sha == lastReflogCommit.Sha && commit.UnixTimestamp == lastReflogCommit.UnixTimestamp {
|
||||
if lastReflogCommit != nil && commit.Sha == lastReflogCommit.Sha && commit.UnixTimestamp == lastReflogCommit.UnixTimestamp {
|
||||
onlyObtainedNewReflogCommits = true
|
||||
// after this point we already have these reflogs loaded so we'll simply return the new ones
|
||||
return true, nil
|
||||
|
@ -73,22 +73,19 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error {
|
||||
|
||||
// during startup, the bottleneck is fetching the reflog entries. We need these
|
||||
// on startup to sort the branches by recency. So we have two phases: INITIAL, and COMPLETE.
|
||||
// In the initial phase we get a small set of reflog entries so that we can ensure
|
||||
// the first couple of branches are correctly positioned. Then we asynchronously
|
||||
// refresh the reflog again, without a limit, and refresh the branches again when that's done.
|
||||
// When we're complete, we can begin recycling reflog entries because we know we've got
|
||||
// everything down to the oldest entry.
|
||||
// In the initial phase we don't get any reflog commits, but we asynchronously get them
|
||||
// and refresh the branches after that
|
||||
func (gui *Gui) refreshReflogCommitsConsideringStartup() {
|
||||
switch gui.State.StartupStage {
|
||||
case INITIAL:
|
||||
go func() {
|
||||
gui.refreshReflogCommits(refreshReflogOptions{Recycle: false})
|
||||
gui.refreshReflogCommits()
|
||||
gui.refreshBranches()
|
||||
gui.State.StartupStage = COMPLETE
|
||||
}()
|
||||
|
||||
case COMPLETE:
|
||||
gui.refreshReflogCommits(refreshReflogOptions{Recycle: true})
|
||||
gui.refreshReflogCommits()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,17 +46,13 @@ func (gui *Gui) handleReflogCommitSelect(g *gocui.Gui, v *gocui.View) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type refreshReflogOptions struct {
|
||||
Recycle bool
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshReflogCommits(options refreshReflogOptions) error {
|
||||
func (gui *Gui) refreshReflogCommits() error {
|
||||
var lastReflogCommit *commands.Commit
|
||||
if len(gui.State.ReflogCommits) > 0 {
|
||||
lastReflogCommit = gui.State.ReflogCommits[0]
|
||||
}
|
||||
|
||||
commits, onlyObtainedNewReflogCommits, err := gui.GitCommand.GetReflogCommits(lastReflogCommit, commands.GetReflogCommitsOptions(options))
|
||||
commits, onlyObtainedNewReflogCommits, err := gui.GitCommand.GetReflogCommits(lastReflogCommit)
|
||||
if err != nil {
|
||||
return gui.createErrorPanel(gui.g, err.Error())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user