From cab985614fd72c2d82e57156e16f09a79c3f19f8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 21 Aug 2016 11:27:47 +1200 Subject: Resolve an issue with incorrect prompt info From `man 1 git-config`: > diff.autoRefreshIndex > When using git diff to compare with work tree files, do not > consider stat-only change as changed. Instead, silently run git > update-index --refresh to update the cached stat information for > paths whose contents in the work tree match the contents in the > index. This option defaults to true. Note that this affects only > git diff Porcelain, and not lower level diff commands such as git > diff-files. --- bash/bashrc.d/prompt.bash | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bash/bashrc.d') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 081cff69..3b0578ba 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -122,6 +122,9 @@ prompt() { fi branch=${branch##*/} + # Refresh index so e.g. git-diff-files(1) is accurate + git update-index --refresh >/dev/null + # Collect symbols representing repository state local state if ! git diff-files --quiet ; then -- cgit v1.2.3