From eac0f059fac2427559c3b56d0e731fae730b18d7 Mon Sep 17 00:00:00 2001 From: Christoph Brandau Date: Mon, 6 Jul 2026 11:31:41 +0200 Subject: [PATCH] feat(history): improve commit hover branch labels and titles The history panel now generates more informative hover text for commits. It prefers direct local branch refs when available, otherwise it derives a concise list from containing branch labels and summarizes overflow. - Add helpers to compute hover branch labels and title text - Update the graph row hover rendering to use the new helpers --- src/lib/components/HistoryPanel.svelte | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/lib/components/HistoryPanel.svelte b/src/lib/components/HistoryPanel.svelte index 7fa3fb3..49f9885 100644 --- a/src/lib/components/HistoryPanel.svelte +++ b/src/lib/components/HistoryPanel.svelte @@ -207,6 +207,24 @@ return labels.filter(branchIsVisible); } + function commitHoverBranchLabels(commit: GitCommit, row: GraphRow | undefined): string[] { + const directBranches = localBranchRefs(commit); + if (directBranches.length > 0) return directBranches; + + const containingBranches = row?.branchLabels ?? []; + if (containingBranches.length <= 3) return containingBranches; + return [...containingBranches.slice(0, 3), `+${containingBranches.length - 3} more`]; + } + + function commitHoverTitle(commit: GitCommit, row: GraphRow | undefined): string { + const directBranches = localBranchRefs(commit); + if (directBranches.length > 0) return `Branches: ${directBranches.join(", ")}`; + + const containingBranches = row?.branchLabels ?? []; + if (containingBranches.length === 0) return commit.short_hash; + return `Branches containing this commit: ${containingBranches.join(", ")}`; + } + function segmentIsVisible(segment: GraphSegment): boolean { return segment.branches.length === 0 || segment.branches.some(branchIsVisible); } @@ -483,7 +501,7 @@ {#each visibleCommitEntries as entry, rowIndex (entry.commit.hash)} {@const item = entry.commit} {@const row = graphRows[rowIndex]} - {@const hoverBranchRefs = visibleBranchLabels(row?.branchLabels ?? [])} + {@const hoverBranchRefs = commitHoverBranchLabels(item, row)} {@const otherRefs = visibleRefs(item)}
1} class:tip={item.refs.length > 0} class:hidden-branch={!rowGraphIsVisible(row)} - title={hoverBranchRefs.length > 0 ? `Contained in: ${hoverBranchRefs.join(", ")}` : item.short_hash} + title={commitHoverTitle(item, row)} style={`left:${graphColX(row.dotCol)}px; --dot-color:${row.dotColor}`} > {#if hoverBranchRefs.length > 0}