Hi,
For some time, we have suffered from an issue where the prompt would report that one (or more) files had been modified when in reality they had not changed. In particular, ReSharper files (MyProject.csproj.ReSharper for example) would exhibit this behaviour. After some investigation, I tracked this down to be caused by ReSharper re-saving the file (thereby changing its last-modified date) without actually changing the file contents. The prompt would display one modified file because the output of `git diff-files -M --name-status` would report the file changed. Running a `git status` would update it and the phantom "modification" would disappear.
Jeremy came across this (
http://permalink.gmane.org/gmane.comp.version-control.git/144178) which details the very same problem and provides an explanation of this behaviour. In order to prevent this happening as the article says, we need to trigger an update of the informaton like so:
git update-index --refresh -q
I have added a call to this into the Get-GitStatus function in order to make sure git diff-files always reports the correct number of changed files. From my understanding, this should not make *too* much difference to the speed of posh-git, but will ensure we always get the correct information back each time the prompt is re-shown.
I've pushed up this change to my fork of posh-git at
http://github.com/markembling/posh-gitMark