Re: git-PS1 bash prompt setting

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

 



On Mon, 27 Nov 2006 12:02:49 -0500
Shawn Pearce <spearce@xxxxxxxxxxx> wrote:

> When I originally coded the first version of __git_ps1 I was using
> it on a Cygwin system, where the fork+exec of the external script
> can take a little while.  The time to fork+exec two programs (script
> and then git) is huge compared to just fork+exec of git by itself,
> so I coded it as a function.  On the other hand my Mac OS X system
> doesn't even blink at either implementation.

For sure, that's probably the reason that it was suggested to be
included as a built-in, it would reduce the overhead.

> I'm not sure that's worth implementing in the core code.
> Most shells that will let you invoke a command as part of their
> prompt generation will also let you use builtin functions and do
> some basic string manipulation (e.g. like I do above with bash).
> At which point it is say 5 lines of shell (nicely formatted) to
> craft a prompt string vs. 15-20 lines of C to parse the option,
> read HEAD, and craft a prompt string.

Well, as per my previous message, it might be a little more worthwhile
if it did things like parse an additional format string which let
you reference config variables and relative directory etc.
It would give a lot of flexibility as to what someone wanted to
use as their PS1 when inside a git repo.
 
> If someone else contributes a --show-ps1 option that is useable as
> a replacement for my __git_ps1 I'll gladly jump on board and change
> to using it, but I just don't see a reason to write it myself.

Yeah.. __git_ps1 could just call "git --show-ps1" if it ever comes
into existence ;o)

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]