mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
only show commits from start ref if bad commit is reachable from there
This commit is contained in:
@ -162,3 +162,11 @@ func (self *BisectCommands) IsDone() (bool, []string, error) {
|
|||||||
|
|
||||||
return done, candidates, nil
|
return done, candidates, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *BisectCommands) ReachableFromStart(ref string, startRef string) bool {
|
||||||
|
err := self.cmd.New(
|
||||||
|
fmt.Sprintf("git merge-base --is-ancestor %s %s", startRef, ref),
|
||||||
|
).Run()
|
||||||
|
|
||||||
|
return err == nil
|
||||||
|
}
|
||||||
|
@ -116,19 +116,12 @@ func (gui *Gui) refreshCommitsWithLimit() error {
|
|||||||
gui.Mutexes.BranchCommitsMutex.Lock()
|
gui.Mutexes.BranchCommitsMutex.Lock()
|
||||||
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
||||||
|
|
||||||
refName := "HEAD"
|
|
||||||
bisectInfo := gui.Git.Bisect.GetInfo()
|
|
||||||
gui.State.BisectInfo = bisectInfo
|
|
||||||
if bisectInfo.Started() {
|
|
||||||
refName = bisectInfo.StartSha()
|
|
||||||
}
|
|
||||||
|
|
||||||
commits, err := gui.Git.Loaders.Commits.GetCommits(
|
commits, err := gui.Git.Loaders.Commits.GetCommits(
|
||||||
loaders.GetCommitsOptions{
|
loaders.GetCommitsOptions{
|
||||||
Limit: gui.State.Panels.Commits.LimitCommits,
|
Limit: gui.State.Panels.Commits.LimitCommits,
|
||||||
FilterPath: gui.State.Modes.Filtering.GetPath(),
|
FilterPath: gui.State.Modes.Filtering.GetPath(),
|
||||||
IncludeRebaseCommits: true,
|
IncludeRebaseCommits: true,
|
||||||
RefName: refName,
|
RefName: gui.refForLog(),
|
||||||
All: gui.State.ShowWholeGitGraph,
|
All: gui.State.ShowWholeGitGraph,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -140,6 +133,22 @@ func (gui *Gui) refreshCommitsWithLimit() error {
|
|||||||
return gui.postRefreshUpdate(gui.State.Contexts.BranchCommits)
|
return gui.postRefreshUpdate(gui.State.Contexts.BranchCommits)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) refForLog() string {
|
||||||
|
bisectInfo := gui.Git.Bisect.GetInfo()
|
||||||
|
gui.State.BisectInfo = bisectInfo
|
||||||
|
|
||||||
|
if !bisectInfo.Started() {
|
||||||
|
return "HEAD"
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to see if our bisect's current commit is reachable from our 'start' ref.
|
||||||
|
if bisectInfo.Bisecting() && !gui.Git.Bisect.ReachableFromStart(bisectInfo.StartSha(), bisectInfo.GetCurrentSha()) {
|
||||||
|
return bisectInfo.GetNewSha()
|
||||||
|
}
|
||||||
|
|
||||||
|
return bisectInfo.StartSha()
|
||||||
|
}
|
||||||
|
|
||||||
func (gui *Gui) refreshRebaseCommits() error {
|
func (gui *Gui) refreshRebaseCommits() error {
|
||||||
gui.Mutexes.BranchCommitsMutex.Lock()
|
gui.Mutexes.BranchCommitsMutex.Lock()
|
||||||
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
||||||
|
@ -175,7 +175,7 @@ func getBisectStatus(commitSha string, bisectInfo *git_commands.BisectInfo, bise
|
|||||||
return BisectStatusSkipped, bisectProgress
|
return BisectStatusSkipped, bisectProgress
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if bisectProgress == InbetweenCommits {
|
if bisectProgress == InbetweenCommits && bisectInfo.Bisecting() {
|
||||||
return BisectStatusCandidate, bisectProgress
|
return BisectStatusCandidate, bisectProgress
|
||||||
} else {
|
} else {
|
||||||
return BisectStatusNone, bisectProgress
|
return BisectStatusNone, bisectProgress
|
||||||
|
Reference in New Issue
Block a user