Skip to content

Conversation

bgw
Copy link
Contributor

@bgw bgw commented Mar 6, 2025

git status (and git describe --dirty) takes an optional write lock as a performance optimization: https://git-scm.com/docs/git-status#_background_refresh

This is bad because:

  • Other processes might run at the same time, try to acquire the lock, and fail.
  • The child process can get killed for a variety of reasons, and may not be able to clean up the lock, leading to later errors about stale lockfiles.

Both of these situations are very hard to root cause and debug.

git describe does not currently support GIT_OPTIONAL_LOCKS=0 (gitgitgadget/git#1872), so this reimplements the -dirty suffix logic using git status.

This is not an issue for libgit2 or gix, but this includes tests for those backends in case they change their implementations.

bgw added a commit to vercel/next.js that referenced this pull request Mar 7, 2025
…) for napi and next-api crates to fix stale git lock files (#76889)

This does not depend on libgit2 which apparently breaks our builds on
some platforms. Instead it uses the git CLI using my PR:
rustyhorde/vergen#406

Original PR: #76773
Revert: #76879

Manually triggered CI run to try to build all platforms:
https://github.com/vercel/next.js/actions/runs/13711866131
@CraZySacX CraZySacX force-pushed the bgw/no-optional-locks branch from 0c96986 to ebb2f12 Compare April 8, 2025 14:18
@CraZySacX CraZySacX merged commit 5de746f into rustyhorde:master Apr 8, 2025
24 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants