Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
status: offer *not* to lock the index and update it
When a third-party tool periodically runs `git status` in order to keep track of the state of the working tree, it is a bad idea to lock the index: it might interfere with interactive commands executed by the user, e.g. when the user wants to commit files. Let's introduce the option `--no-lock-index` to prevent such problems. The idea is that the third-party tool calls `git status` with this option, preventing it from ever updating the index. The downside is that the periodic `git status` calls will be a little bit more wasteful because they may have to refresh the index repeatedly, only to throw away the updates when it exits. This cannot really be helped, though, as tools wanting to get a periodic update of the status have no way to predict when the user may want to lock the index herself. Note that the regression test added in this commit does not *really* verify that no index.lock file was written; that test is not possible in a portable way. Instead, we verify that .git/index is rewritten *only* when `git status` is run without `--no-lock-index`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Loading branch information