Skip to content

Commit

Permalink
Merge pull request #6284 from gitbutlerapp/Only-include-valid-unarchi…
Browse files Browse the repository at this point in the history
…ved-branches

Only include valid, unarchived branches in stacking metric
  • Loading branch information
Caleb-T-Owens authored Feb 8, 2025
2 parents 16df0eb + 76af033 commit 22ad4f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/desktop/src/lib/branches/virtualBranchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,16 @@ Path: ${e.path}`);
const files = branches.flatMap((branch) => branch.files);
const hunks = files.flatMap((file) => file.hunks);
const lockedHunks = hunks.filter((hunk) => hunk.locked);
const validUnarchivedSeriesLengths = branches.map(
(b) => b.validSeries.filter((series) => !series.archived).length
);
this.projectMetrics.setMetric('hunk_count', hunks.length);
this.projectMetrics.setMetric('locked_hunk_count', lockedHunks.length);
this.projectMetrics.setMetric('file_count', files.length);
this.projectMetrics.setMetric('virtual_branch_count', branches.length);
this.projectMetrics.setMetric(
'max_stack_count',
branches.length > 0 ? Math.max(...branches.map((b) => b.series.length)) : 0
branches.length > 0 ? Math.max(...validUnarchivedSeriesLengths) : 0
);
} catch (err: unknown) {
console.error(err);
Expand Down

0 comments on commit 22ad4f9

Please sign in to comment.