fix(turbopack): Use vergen-git2 instead of shadow-rs for napi and next-api…
fix(turbopack): Use vergen-git2 instead of shadow-rs for napi and next-api crates to fix stale git lock files (#76773) Both `shadow-rs` and `vergen-gitcl` call out to the git CLI, which takes optional locks to update the index: https://git-scm.com/docs/git-status#_background_refresh This is why we sometimes find ourselves with stale `.git/index.lock` files. Using a lightly patched version of https://github.com/martinpitt/fatrace (to look up parent process names) shows this:  `shadow-rs` has a `git2` feature (enabled by default), but that doesn't prevent it from running the git CLI. Instead it runs *both* and overwrites some values. `vergen-git2` only uses `libgit2` and does not invoke the CLI. This fixes things because `libgit2` disables `GIT_STATUS_OPT_UPDATE_INDEX` by default. Additionally, after looking through both codebases, I've decided I like `vergen`'s implementation a bit more than `shadow-rs`'s. Supposedly, `git`'s command-line should support a `GIT_OPTIONAL_LOCKS=0` environment variable to disable this behavior, but I'm still finding the lock written to when trying to use that. I'm still investigating if I can use something like this to contribute a proper fix upstream to these crates.
Showing
This diff is collapsed.
Please
register
or
sign in
to comment