---
title: CommitReader
description: >-
  Reads one request's worth of commits. Make one per request with
  `commitReader`.
updated_at: '2026-11-26T00:01:46+01:00'
created_at: '2026-11-19T08:33:37+01:00'
symbol:
  kind: interface
  name: CommitReader
  signatures:
    - interface CommitReader
  members:
    - name: history
      kind: method
      signature: >-
        history(path: string, page: number): Promise<{ readonly commits:
        readonly [[reference/api/plugin-submissions/commits/Commit|Commit]][];
        readonly more: boolean }>
      description: >-
        The commits that changed `path`, a page of
        [[reference/api/plugin-submissions/commits/GITHUB_PAGE_SIZE|GITHUB_PAGE_SIZE]]
        at a time counting from 1, in the branch's order: GitHub's list for the
        file, which walks the branch's ancestry, with what the mirror knows of
        each. The mirror can't order them itself: commit times tie and can be
        backdated, and push deliveries don't name a commit's parents. `more`
        says whether GitHub may hold older ones. Renames aren't followed: the
        history of a moved file starts at the move.
    - name: recent
      kind: method
      signature: >-
        recent(before?: string): Promise<{ readonly commits: readonly
        [[reference/api/plugin-submissions/commits/Commit|Commit]][]; readonly
        next?: string }>
      description: >-
        The commits that changed a vault file, newest commit time first, from
        the mirror only: those whose files it knows. `before` is the sha of the
        last commit of the previous page; `next` is this page's, when there may
        be more.
    - name: madeBy
      kind: method
      signature: >-
        madeBy(account: string, options?: { readonly before?: string; readonly
        limit?: number }): Promise<{ readonly commits: readonly
        [[reference/api/plugin-submissions/commits/Commit|Commit]][]; readonly
        next?: string; readonly files: readonly string[] }>
      description: >-
        The commits the site's records say the account `account` (its id) made,
        from the mirror only, as
        [[reference/api/plugin-submissions/commits/CommitReader-interface|recent]]
        pages them: `limit` at a time (default
        [[reference/api/plugin-submissions/commits/RECENT_PAGE_SIZE|RECENT_PAGE_SIZE]]),
        newest commit time first, `before` the last sha of the previous page.
        Only those whose files the mirror knows. `files` is every vault file any
        of its commits changed, most recently changed first, whichever page is
        asked for. One D1 batch, then one query.
    - name: onBranch
      kind: method
      signature: 'onBranch(sha: string): Promise<boolean>'
      description: >-
        Whether `sha` is a commit on the content branch of the repository, never
        one of a fork's.
    - name: commit
      kind: method
      signature: >-
        commit(sha: string):
        Promise<[[reference/api/plugin-submissions/commits/Commit|Commit]] |
        undefined>
      description: 'The commit `sha`, when it is on the content branch.'
    - name: previous
      kind: method
      signature: >-
        previous(path: string, sha: string):
        Promise<[[reference/api/plugin-submissions/commits/Commit|Commit]] |
        undefined>
      description: >-
        The commit that changed `path` before `sha` did, by `sha`'s ancestry as
        GitHub's list for the file walks it; `undefined` too when `sha` isn't on
        the content branch.
    - name: file
      kind: method
      signature: >-
        file(path: string, sha: string):
        Promise<[[reference/api/plugin-submissions/commits/FileAt|FileAt]]>
      description: >-
        `path`'s content at commit `sha`; `missing` too when `sha` isn't on the
        content branch.
    - name: headFile
      kind: method
      signature: >-
        headFile(path: string, sha: string):
        Promise<[[reference/api/plugin-submissions/commits/FileAt|FileAt]]>
      description: >-
        `path`'s content at `sha`, the head commit GitHub just named for one of
        this repository's open pull requests, which needn't be on the content
        branch. The caller vouches for `sha`: never pass one a reader sent.
    - name: refresh
      kind: method
      signature: 'refresh(): void'
      description: >-
        Have the reconcile poll read GitHub after the answer, when the mirror is
        stale; it backfills on its first run.
  source: >-
    https://github.com/mia-cx/svartz/blob/711f3906a713c8b9a5a572d0f34c85e90c3bc3d1/packages/plugin-submissions/src/commits.ts#L94
---

# CommitReader
