diff options
author | SZEDER Gábor <szeder@ira.uka.de> | 2015-11-21 12:30:09 +0100 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2015-11-24 15:27:01 -0500 |
commit | c26f70ceb3960603a78010c87f8ad11820ab6561 (patch) | |
tree | 7d7b8837f661e2fff1170ed1121c4c14955a0235 /sigchain.h | |
parent | bash prompt: remove a redundant 'git diff' option (diff) | |
download | tgif-c26f70ceb3960603a78010c87f8ad11820ab6561.tar.xz |
bash prompt: indicate dirty index even on orphan branches
__git_ps1() doesn't indicate dirty index while on an orphan branch.
To check the dirtiness of the index, __git_ps1() runs 'git diff-index
--cached ... HEAD', which doesn't work on an orphan branch,
because HEAD doesn't point to a valid commit.
Run 'git diff ... --cached' instead, as it does the right thing both
on valid and invalid HEAD, i.e. compares the index to the existing
HEAD in the former case and to the empty tree in the latter. This
fixes the two failing tests added in the first commit of this series.
The dirtiness of the worktree is already checked with 'git diff' and
is displayed correctly even on an orphan branch.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'sigchain.h')
0 files changed, 0 insertions, 0 deletions