jimeh / git-aware-prompt

Display current Git branch name in your terminal prompt when in a Git working directory.
Creative Commons Zero v1.0 Universal
2.16k stars 340 forks source link

git status modifies .git/index - changing ownership #57

Closed nneul closed 6 years ago

nneul commented 6 years ago

In it's current form, this tool causes negative impact if run as a user that has privileges - it winds up changing the ownership of .git/index in repos if you cd into another account.

It can be mitigated by removing/disabling the 'dirty repo' support by removing the call to 'find_git_dirty' in prompt.sh PROMPT_COMMAND.

I do not know yet of any way to keep git status from modifying that file. Opened a stackoverflow question on the topic, will see if anyone has a suggestion:

https://stackoverflow.com/questions/47436939/how-to-run-git-status-without-modifying-git-index-such-as-in-a-prompt-command

nneul commented 6 years ago

Got an answer, apparently you can add (for git > 2.15) "--no-optional-locks" to the git status command to address this.