Skip to content

Commit 5e83cca

Browse files
peffgitster
authored andcommitted
git-status.txt: mention --no-optional-locks
If you come to the documentation thinking "I do not want Git to take any locks for my background processes", then you may easily run across "--no-optional-locks" in git.txt. But it's quite reasonable to hit a specific instance of the problem: you have "git status" running in the background, and you notice that it causes lock contention with other processes. So you look in git-status.txt to see if there is a way to disable it, but there's no mention of the flag. Let's add a short note mentioning that status does indeed touch the index (and why), with a pointer to the global option. That can point users in the right direction and help them make a more informed decision about what they're disabling. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27344d6 commit 5e83cca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Documentation/git-status.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,19 @@ ignored submodules you can either use the --ignore-submodules=dirty command
366366
line option or the 'git submodule summary' command, which shows a similar
367367
output but does not honor these settings.
368368

369+
BACKGROUND REFRESH
370+
------------------
371+
372+
By default, `git status` will automatically refresh the index, updating
373+
the cached stat information from the working tree and writing out the
374+
result. Writing out the updated index is an optimization that isn't
375+
strictly necessary (`status` computes the values for itself, but writing
376+
them out is just to save subsequent programs from repeating our
377+
computation). When `status` is run in the background, the lock held
378+
during the write may conflict with other simultaneous processes, causing
379+
them to fail. Scripts running `status` in the background should consider
380+
using `git --no-optional-locks status` (see linkgit:git[1] for details).
381+
369382
SEE ALSO
370383
--------
371384
linkgit:gitignore[5]

0 commit comments

Comments
 (0)