Skip to content

Add support for GIT_OPTIONAL_LOCKS environment variable #1861

@jelmer

Description

@jelmer

Description

Add support for the GIT_OPTIONAL_LOCKS environment variable, which allows skipping operations that require locks.

Background

The GIT_OPTIONAL_LOCKS environment variable, when set to 0, tells Git to skip operations that would normally require file locks. This is useful for read-only scenarios or when multiple processes need to access a repository simultaneously.

Use Case in Dulwich

This would be valuable for Dulwich users who:

  • Run read-only operations in environments where locking might fail
  • Need concurrent access to repositories from multiple processes
  • Work in containerized or restricted environments where file locking is problematic

Implementation Notes

This would require checking the environment variable before attempting to acquire locks on repository files, gracefully skipping lock-dependent operations when set to 0.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions