Skip to content

Drafting a commit message leaves the staged files' objects in the repository #34594

Closed

Description

@yaacovcorcos

Area: apps/server

Steps to reproduce

  1. In a repository, change or add a file (for example a large generated file or dataset).
  2. Run the Commit action with an empty message, so T3 prepares the commit context
    (prepareCommitContext) to generate one.
  3. Let the generation fail or stop it before the commit runs (for example, the text-generation
    provider is signed out or offline).
  4. Run git cat-file -e $(git hash-object <file>).

Expected behavior

Preparing the context uses a temporary index, so without a commit the repository is unchanged.

Actual behavior

The object exists, unreachable. prepareCommitContext sets only GIT_INDEX_FILE to a temporary index and runs
git add -A, and git add writes every staged blob into the repository's object store. When the commit
follows, it needs those blobs anyway; when it does not, they stay as unreachable loose objects, and
each attempt after the file changes adds another copy. gc prunes them only when maintenance runs
and they are older than its expiry (two weeks by default). For large generated files or datasets
that is their compressed size, close to the file size for data that does not compress, and later
maintenance (a cruft repack) has to read all of it.

Impact

Minor bug or occasional failure

Version or commit

main at a02bc75

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions