https://git-scm.com/docs/git#Documentation/git.txt—no-optional-locks
–no-optional-locks Do not perform optional operations that require locks. This is equivalent to setting the > GIT_OPTIONAL_LOCKS to 0.
このフラグを付けないとどうやらgit statusしたときにindex.lockを作ってしまうらしい。するとgit addとかcommitとか色々な操作ができなくなる。裏で定期的にgit statusするような場合、このオプションが必須。
他にもこういうissueも。
git操作がよくロックされるな〜IDEが何かやってるのかな〜とか思ってたけど、自分で作ったccstatuslineでこのオプションを使ってなくてclaude起動するとほぼ常にindex.lockが存在しちゃうのが原因だった。
https://github.com/sters/ccstatusline/blob/main/src/lib/git.ts