(commitHash: HTMLElement)
| 41 | } |
| 42 | |
| 43 | async function add(commitHash: HTMLElement): Promise<void> { |
| 44 | const commitSha = location.pathname.split('/').pop()!; |
| 45 | const [additions, deletions] = await commitChanges.get(commitSha); |
| 46 | const tooltip = pluralize(additions + deletions, '1 line changed', '$$ lines changed'); |
| 47 | const {green, red, gray} = calculateDiffSquareCounts(additions, deletions); |
| 48 | commitHash.prepend( |
| 49 | tooltipped( |
| 50 | tooltip, |
| 51 | <span className="ml-2 tmp-ml-2 d-md-block d-none diffstat"> |
| 52 | <span className="color-fg-success">+{additions}</span> |
| 53 | {' '} |
| 54 | <span className="color-fg-danger">−{deletions}</span> |
| 55 | {' '} |
| 56 | {repeatItems(green, () => <span className="diffstat-block-added" />)} |
| 57 | {repeatItems(red, () => <span className="diffstat-block-deleted" />)} |
| 58 | {repeatItems(gray, () => <span className="diffstat-block-neutral" />)} |
| 59 | </span>, |
| 60 | ), |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | async function init(signal: AbortSignal): Promise<void> { |
| 65 | observe('[class*="__CommitAttributionContainer"] + .text-mono', add, {signal}); |
nothing calls this directly
no test coverage detected