import Link from "next/link";
import { commitCount, lastCommit, listTree, type Commit, type TreeEntry } from "@/lib/git";
import { encodePath, shortSha, timeAgo } from "@/lib/format";
import type { Repo } from "@/lib/repo";
import { ClockIcon, CommitIcon, DirIcon, FileIcon, SubmoduleIcon } from "./icons";
import { liftRowClass } from "./repo-rows";
import { Avatar, Box } from "./ui";
// Looking up the last commit is one git call per entry; skip it for huge directories.
const MAX_ENTRIES_WITH_COMMITS = 200;
/** A short sha on a small raised key: the commit glyph and the mono hash. */
export function ShaChip({ sha, href, className = "" }: { sha: string; href: string; className?: string }) {
return (
{shortSha(sha)}
);
}
/** The last commit to touch a path, sunk into the head of its plate: who, what, which and when, and the way to the history. */
export function LatestCommitBar({ repo, commit, count, gitRef, path }: {
repo: Repo;
commit: Commit;
count?: number;
gitRef: string;
path?: string;
}) {
const historyHref = `${repo.base}/commits/${encodePath(gitRef)}${path ? `/${encodePath(path)}` : ""}`;
return (