Skip to content

Plugin git installs clone the whole repository instead of fetching the resolved commit #7910

Closed

Description

@afn

Summary

Installing or updating a plugin from a git: source makes bb run a full git clone of the whole repository, then git checkout <commit>, and then it deletes .git anyway. For a plugin that lives in a large or long-lived repository (for example a marketplace monorepo that holds many plugins), each install, update, and install-probe downloads the complete history before anything else happens; on a slow link this takes minutes or hits the 5-minute command timeout. I expected bb to download only the resolved commit.

Versions and environment

  • bb 0.49.0 (Nix-packaged upstream build of get-bb/bb, run with --data-dir), macOS 27.2.1, git 2.56.1
  • Reproduced in the repo's own test suite on main at fab82665a3299fae8910f55d7519a3b034a03b9a
  • Nothing provider-related; this is the plugin install path on the server

Steps to reproduce

  1. Register a marketplace or install a plugin whose git: source is a repository with a large history, e.g. bb plugin install git:github.com/<org>/<big-monorepo>@main --plugin <name>.
  2. While the install job is running, ps aux | grep 'git clone' and watch du -sh <dataDir>/plugins/cache/git/<host>/<org>/<repo>/<sha>.install-probe-*/.git grow.
  3. Compare with git init t && git -C t fetch --depth 1 <url> <sha> for the same commit.

Minimal fixture-level repro: a repository that carries a ref whose object is missing. git clone refuses it, while fetching the resolved commit by SHA succeeds, so a plugin install from that repository fails today even though the plugin's commit is intact. (This is the deterministic form used in the test that accompanies the fix.)

Expected vs actual

Actual (bb 0.49.0, marketplace monorepo with ~90 plugins):
  git clone --quiet https://github.com/<org>/<monorepo>.git .../<sha>.install-probe-<uuid>
  ... .git reached 624 MB and was still downloading after several minutes;
  two such clones ran concurrently (one install probe, one update staging);
  the marketplace refresh for the same repo reported "git -c timed out".

Expected:
  git init + git fetch --depth 1 <url> <sha> + checkout FETCH_HEAD
  same commit: 8.8 s, 82 MB of .git, and bb deletes .git right after checkout anyway.

Evidence

  • Code: cloneGitCommit at
    async function cloneGitCommit(
    url: string,
    stagingDir: string,
    commit: string,
    notFoundHint?: string,
    ): Promise<void> {
    await runInstallCommand("git", ["clone", "--quiet", url, stagingDir], {
    notFoundHint,
    });
    await runInstallCommand("git", [
    "-C",
    stagingDir,
    "checkout",
    "--quiet",
    "--detach",
    commit,
    ]);
    const checkedOutCommit = await runInstallCommand("git", [
    "-C",
    stagingDir,
    "rev-parse",
    "HEAD",
    ]);
    if (!checkedOutCommit.startsWith(commit)) {
    throw new Error(
    `git resolved ${commit}, but checked out ${checkedOutCommit}`,
    );
    }
    — git clone with no --depth/--filter, then checkout --detach <commit>, then rm .git.
  • All three callers (install, install probe for semver ranges, update staging) go through it: L628, L795, L1215 of the same file.
  • The resolved commit is always a full 40-hex SHA (validated in update-resolver.ts ls-remote parsing), so it can be fetched directly on servers that allow it (GitHub, GitLab, Bitbucket, and any local path repo with protocol v2).
  • Measured with time and du -sh on the same commit of the same repository.

What you ruled out

Suggested priority and effort

Hits every user who installs from a git monorepo or any repository with a long history; the workaround is to publish the plugin on npm. Small change in one function plus a fallback to the full clone for servers that refuse fetch-by-SHA.

AGENT GENERATED

Activity

  1. added theissue type on Nov 20, 2026
  2. added
    plugins
    confirmed-repro
    on Nov 20, 2026
  3. bb-slop-cop commented on Nov 20, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    AGENT GENERATED

  4. added a commit that references this issue on Nov 20, 2026
    81b1f61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproperfplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions