summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2013-06-24 12:49:19 +0200
committerSZEDER Gábor <szeder@ira.uka.de>2013-06-24 18:03:37 +0200
commit0f37c125814afc8ad2fa43fecd8b200216ebfab5 (patch)
tree8361a91e976b7b66f4b2ac704ca8e9b1a5dfd4aa /commit.h
parente3e0b9378b6e51ea50c023d92d4d2a1f4d4cc676 (diff)
downloadgit-0f37c125814afc8ad2fa43fecd8b200216ebfab5.tar.gz
bash prompt: use bash builtins to check for unborn branch for dirty state
When the dirty work tree and index status indicator is enabled, __git_ps1() checks for changes in the index by running 'git diff-index --cached --quiet HEAD --' and looking at its exit code. However, that makes sense only when HEAD points to a valid commit: on an unborn branch the failure of said command would be caused by the invalid HEAD, not by changes in the index. Therefore, __git_ps1() first checks for a valid HEAD by running 'git rev-parse --quiet --verify HEAD'. Since the previous patch we implicitly check HEAD's validity by running 'git rev-parse ... --short HEAD', making the dirty status indicator's 'git rev-parse' check redundant. It's sufficient to check for non-emptyness of the variable holding the abbreviated commit object name, thereby sparing the overhead of fork()+exec()ing a git process. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Diffstat (limited to 'commit.h')
0 files changed, 0 insertions, 0 deletions