Re: [PATCH 05/19] bash prompt: don't show the prompt when .git/HEAD is unreadable
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 9, 2012, 19:32 UTC
- Message-ID
- <7vipg5rvzf.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1336524290-30023-6-git-send-email-szeder@ira.uka.de>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 10 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index ab26bdc8..cd6a5f12 100755 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -258,7 +258,7 @@ __git_ps1 () > esac 2>/dev/null)" || > > b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || > - b="unknown" > + return
While you are touching the vicinity of the code, could we lose that "cut" and replace it with "rev-parse --short HEAD", without the hardcoded 1-7?
I wondered if we can use a single "git describe" output for all the describe/default and failure cases but didn't come up with a good way to do so only by using bash built-ins.