Skip to content

Commit c0adcf7

Browse files
authored
Dedupe equal author and committer in commit header (#109)
1 parent c89a3dc commit c0adcf7

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

core/app/components/CommitDetails.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ function CommitStatsChips({ stats }: { stats: CommitMetadata['stats'] }) {
7373
);
7474
}
7575

76+
function isSamePerson(a: CommitMetadata['author'], b: CommitMetadata['committer']): boolean {
77+
return a.name === b.name && a.email === b.email && a.date === b.date;
78+
}
79+
7680
function CommitPersonRow({ label, person }: { label: string; person: CommitMetadata['author'] }) {
7781
return (
7882
<div className="commit-details-person">
@@ -194,8 +198,14 @@ export function CommitDetailsPanel({
194198
</section>
195199
) : null}
196200
<section aria-label="Commit metadata" className="commit-details-grid">
197-
<CommitPersonRow label="Author" person={metadata.author} />
198-
<CommitPersonRow label="Committer" person={metadata.committer} />
201+
{isSamePerson(metadata.author, metadata.committer) ? (
202+
<CommitPersonRow label="Author & Committer" person={metadata.author} />
203+
) : (
204+
<>
205+
<CommitPersonRow label="Author" person={metadata.author} />
206+
<CommitPersonRow label="Committer" person={metadata.committer} />
207+
</>
208+
)}
199209
<div className="commit-details-cell">
200210
<h3>Refs</h3>
201211
{metadata.refs.length > 0 ? (

0 commit comments

Comments
 (0)