aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/routes/api/v1/repo/map.ts
blob: 0544e4fd2f4724a4052d660c01993c63af3e8bc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Commit } from "../../../../git/commit";
import { LogCommit } from "api";

export async function commitMap(commit: Commit): Promise<LogCommit> {
	const stats = await commit.stats();
	return <LogCommit>{
		id: commit.id,
		author: {
			name: commit.author().name,
			email: commit.author().email,
			fingerprint: await commit.author().fingerprint().catch(() => null)
		},
		isSigned: await commit.isSigned(),
		message: commit.message,
		date: commit.date,
		insertions: stats.insertions,
		deletions: stats.deletions,
		files_changed: stats.files_changed
	};
}