Re: [PATCH 4/10] Add current branch in PS1 support to git-completion.bash.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sean <seanlkml@xxxxxxxxxxxx> wrote:
> On Mon, 27 Nov 2006 03:41:28 -0500
> "Shawn O. Pearce" <spearce@xxxxxxxxxxx> wrote:
> 
> > 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.
> 
> Suppose it doesn't hurt to include support for this in git completion
> scripts.  It doesn't look like __git_ps1 is a proper name though,
> perhaps __git_branch or __git_current_branch would be better?

I actually started with the name __git_current_branch but changed
my mind on that and went with __git_ps1.

My rationale at the time was probably not correct (it was early this
morning) but I figured that the current branch name is "master"
while __git_ps1 prints " (master)".  Therefore __git_ps1 is not
really printing the current branch, its printing the current branch
and other stuff.  So I went with a name which implied its purpose.

-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]