Code

Add current branch in PS1 support to git-completion.bash.
authorShawn O. Pearce <spearce@spearce.org>
Mon, 27 Nov 2006 08:41:28 +0000 (03:41 -0500)
committerJunio C Hamano <junkio@cox.net>
Mon, 27 Nov 2006 20:09:16 +0000 (12:09 -0800)
commitd3d717a4ad0c8d7329e79f7d0313baec57c6b585
tree03b3419fea3d87dd91229d24b0dac1a7e8c08eec
parentd33909bf6e78e6ab8a45bfdd19bc19213fde5501
Add current branch in PS1 support to git-completion.bash.

Many users want to display the current branch name of the current git
repository as part of their PS1 prompt, much as their PS1 prompt might
also display the current working directory name.

We don't force our own PS1 onto the user.  Instead we let them craft
their own PS1 string and offer them the function __git_ps1 which they
can invoke to obtain either "" (when not in a git repository) or
"(%s)" where %s is the name of the current branch, as read from HEAD,
with the leading refs/heads/ removed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/completion/git-completion.bash