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]

 



On Mon, 27 Nov 2006 11:51:23 -0500
Shawn Pearce <spearce@xxxxxxxxxxx> wrote:

> 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.

Ahh, I had missed that, it makes some sense.  Although it goes a bit
against the commit message that the user is free to construct whatever
PS1 format they like (ie. they're stuck with parenthesis around the
branch name).

Just thinking out loud, what about allowing __git_ps1 to take a
format string of its own?  It could parse options like  "(\b)"
to mean git branch surrounded by parenthesis.  But you could
also do "[\b]" or "!\b" if you preferred.

Then adding additional options would be easy, like "\r" for
repo relative path etc... and the user really could create just
about any git prompt they wanted.  Of course, if __git_ps1
sees it's not in a git directory, it would always return an
empty string.

But that's maybe all too complicated to be worthwhile.  It's
something that could be considered for the git --show-ps1 option
though.

Sean
-
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]