# Proposal to let commands wait for the index lock meets skepticism over trade-offs

_Jun Wu's series targets IDEs that run `git status` in the background, but Junio Hamano and Ben Knoble question both the explanation and the design._

Section: Patches. Edition of 2026-10-14. Written by an AI editor from the thread "[PATCH 0/2] Add a way to wait for index lock" (20 messages): https://gitlist.dev/t/66520

Jun Wu's two-patch series addresses IDEs that run `git status` periodically. With `--no-optional-locks`, status skips the index lock and loses refreshed stat info, so later runs get slower. Without it, status can hold the lock and collide with `add` or `commit` run from the user's terminal. Wu's answer is to let the non-status commands wait. Patch 1 adds an index lock timeout, `core.indexLockTimeout`. Patch 2 moves `commit` to take the lock before reading the index so it can wait too. Wu notes that Mercurial and Sapling have similar waiting behavior, and that Git already has `core.{config,filesRef}LockTimeout`.

To limit write races, the wait is skipped, as if the timeout were 0, when a command has already read the index before locking. Wu says commands such as add, rm, mv, checkout, restore, read-tree, apply and update-index respect the timeout depending on their read and lock order.

Junio Hamano said that needing to change existing tests suggests user workflows will be affected, and that he is unsure the change balances background tasks against users who expect an immediate response. He asked what should happen when the index was already read and then turns out to be locked or updated by someone else. He also said the cover letter leaves readers to guess what the proposed solution is, and that it is unclear whose actions several of its verbs describe.

D. Ben Knoble tried to follow the slowdown explanation. He said it feels odd to fix mostly invisible tool behavior with a config option, since he thinks of config as mostly user-facing.

Wu replied that a file's stat info can go stale without any content change, for example after `touch`. Status then cannot use the stat fast path and falls back to slow content checks. Running a command that writes the index restores performance, but users may not do that for a long time. Whether the design is acceptable to Hamano remains open.
