Skip to content

Refreshing the page during commit can break HEAD ref #2290

@tomlarkworthy

Description

@tomlarkworthy

I am creating and maintaining a repository PURELY in index-db via lighning-fs. There is no remote.

Occasionally I get

RuntimeError: Failed to checkout "default" because commit 9c674814d3115a77cf4293ec750a7a9d1dc87e28 is not available locally. Do a git fetch to make the branch available locally.

Which I think occurs if the page is restarted during a commit.

Claude: The race condition is clear:

  1. Line 165-171: Write commit object (no fsync)
  2. Line 174-179: Update ref to point to new commit (no fsync)

So the commit and the update-ref can go out-of-order

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions