summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-26 19:12:44 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-26 19:29:17 +1100
commit5a3f81d1f7a0c66572ea4044a5910cdf1954fefb (patch)
treec273015c8d392dad26601282fa8634efe27e93b8 /pkg/commands
parentebbdf829e793eb0bbac819eef4bffacf0bce48fb (diff)
select current bisect commit even if bisect was started on another branch
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/bisect.go7
-rw-r--r--pkg/commands/git_commands/bisect_info.go2
2 files changed, 6 insertions, 3 deletions
diff --git a/pkg/commands/git_commands/bisect.go b/pkg/commands/git_commands/bisect.go
index b032afc45..b09a50bf5 100644
--- a/pkg/commands/git_commands/bisect.go
+++ b/pkg/commands/git_commands/bisect.go
@@ -163,9 +163,12 @@ func (self *BisectCommands) IsDone() (bool, []string, error) {
return done, candidates, nil
}
-func (self *BisectCommands) ReachableFromStart(ref string, startRef string) bool {
+// tells us whether the 'start' ref that we'll be sent back to after we're done
+// bisecting is actually a descendant of our current bisect commit. If it's not, we need to
+// render the commits from the bad commit.
+func (self *BisectCommands) ReachableFromStart(bisectInfo *BisectInfo) bool {
err := self.cmd.New(
- fmt.Sprintf("git merge-base --is-ancestor %s %s", startRef, ref),
+ fmt.Sprintf("git merge-base --is-ancestor %s %s", bisectInfo.GetNewSha(), bisectInfo.GetStartSha()),
).DontLog().Run()
return err == nil
diff --git a/pkg/commands/git_commands/bisect_info.go b/pkg/commands/git_commands/bisect_info.go
index 9b812a17f..5b3b1f028 100644
--- a/pkg/commands/git_commands/bisect_info.go
+++ b/pkg/commands/git_commands/bisect_info.go
@@ -59,7 +59,7 @@ func (self *BisectInfo) GetCurrentSha() string {
return self.current
}
-func (self *BisectInfo) StartSha() string {
+func (self *BisectInfo) GetStartSha() string {
return self.start
}