Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/renderer/bisect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ export class Bisector {
}
}

public skip() {
const prevPivot = this.pivot;
this.pivot =
Math.floor(
Math.pow(Math.random(), 1.5) * (this.maxRev - this.minRev + 1),
) + this.minRev;

if (this.pivot === prevPivot && this.pivot > this.minRev) this.pivot--;

return this.revList[this.pivot];
}

private calculatePivot() {
this.pivot = Math.floor((this.maxRev - this.minRev) / 2);
}
Expand Down
16 changes: 16 additions & 0 deletions src/renderer/components/commands-bisect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export const BisectHandler = observer(
}
}

private skipBisect() {
window.app.runner.stop();
const { appState } = this.props;
const response = appState.Bisector!.skip();

appState.setVersion(response.version);
}

private terminateBisect() {
const { appState } = this.props;
appState.Bisector = undefined;
Expand All @@ -75,6 +83,14 @@ export const BisectHandler = observer(
onClick={() => this.continueBisect(false)}
disabled={isDownloading}
/>
<Button
icon={'random'}
aria-label={'Skip this commit'}
onClick={() => this.skipBisect()}
disabled={isDownloading}
>
Skip
</Button>
<Button
aria-label={'Cancel bisect'}
icon={'cross'}
Expand Down