From 1db44285016060c02353365ca9f6cdd0d442dded Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 31 Aug 2016 13:06:37 +1200 Subject: Move git index update higher up --- bash/bashrc.d/prompt.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bash/bashrc.d') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index e8429b26..843c5ce4 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -101,6 +101,9 @@ prompt() { iswt=$(git rev-parse --is-inside-work-tree 2>/dev/null) [[ $iswt = true ]] || return + # Refresh index so e.g. git-diff-files(1) is accurate + git update-index --refresh >/dev/null + # Find a local branch, remote branch, or tag (annotated or not), or # failing all of that just show the short commit ID, in that order # of preference; if none of that works, bail out @@ -110,9 +113,6 @@ prompt() { name=${name##*/} [[ -n $name ]] || return - # Refresh index so e.g. git-diff-files(1) is accurate - git update-index --refresh >/dev/null - # Check various files in .git to flag processes local proc [[ -d .git/rebase-merge || -d .git/rebase-apply ]] && -- cgit v1.2.3