Skip to content

Commit 6078330

Browse files
committed
Fixes all branches & branch slicing on timeline
1 parent 37ba74e commit 6078330

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/webviews/apps/plus/timeline/timeline.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,14 @@ export class GlTimelineApp extends GlAppHost<State> {
345345
}
346346

347347
private renderConfigHead() {
348-
const {
349-
head,
350-
config: { showAllBranches },
351-
} = this;
348+
const { head } = this;
349+
const disabled = this.config.showAllBranches && this.sliceBy !== 'branch';
350+
352351
return html`<section>
353-
<label for="head" ?disabled=${showAllBranches}>Branch</label>
352+
<label for="head" ?disabled=${disabled}>Branch</label>
354353
<gl-ref-button
355354
name="head"
356-
?disabled=${showAllBranches}
355+
?disabled=${disabled}
357356
icon
358357
tooltip="Change Reference"
359358
.ref=${head}
@@ -533,9 +532,18 @@ export class GlTimelineApp extends GlAppHost<State> {
533532
}
534533
if (result?.ref == null) return;
535534

535+
if (location === 'config') {
536+
this._ipc.sendCommand(UpdateScopeCommand, {
537+
scope: this.scope!,
538+
changes: { head: result.ref, base: this.config.showAllBranches ? null : undefined },
539+
});
540+
541+
return;
542+
}
543+
536544
this._ipc.sendCommand(UpdateScopeCommand, {
537545
scope: this.scope!,
538-
changes: { head: result.ref, base: location !== 'config' ? null : undefined },
546+
changes: { head: result.ref, base: null },
539547
});
540548
if (this.config.showAllBranches) {
541549
this._ipc.sendCommand(UpdateConfigCommand, { changes: { showAllBranches: false } });

src/webviews/plus/timeline/timelineWebview.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -692,17 +692,21 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
692692
return generateRandomTimelineDataset(scope.type);
693693
}
694694

695-
let ref = scope.head?.ref;
696-
if (ref) {
697-
if (scope.base?.ref != null && scope.base?.ref !== ref) {
698-
ref = createRevisionRange(ref, scope.base?.ref, '..');
695+
let ref;
696+
if (!config.showAllBranches) {
697+
ref = scope.head?.ref;
698+
if (ref) {
699+
if (scope.base?.ref != null && scope.base?.ref !== ref) {
700+
ref = createRevisionRange(ref, scope.base?.ref, '..');
701+
}
702+
} else {
703+
ref = scope.base?.ref;
699704
}
700-
} else {
701-
ref = scope.base?.ref;
702705
}
703706

704707
const [contributorsResult, statusFilesResult, currentUserResult] = await Promise.allSettled([
705708
repo.git.contributors().getContributors(ref, {
709+
all: config.showAllBranches,
706710
pathspec: scope.type === 'repo' ? undefined : scope.uri.fsPath,
707711
since: getPeriodDate(config.period)?.toISOString(),
708712
stats: true,
@@ -745,7 +749,7 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
745749
}
746750
}
747751

748-
if (config.showAllBranches && config.sliceBy === 'branch' && scope.type !== 'repo') {
752+
if (config.showAllBranches && config.sliceBy === 'branch' && scope.type !== 'repo' && !repo.virtual) {
749753
const shas = new Set<string>(
750754
await repo.git.commits().getLogShas?.('^HEAD', { all: true, pathOrUri: scope.uri, limit: 0 }),
751755
);

0 commit comments

Comments
 (0)