From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: Eran Tromer <git2eran@tromer.org>
Cc: git@vger.kernel.org
Subject: Re: [StGIT PATCH] Bash snippet to show branch and patch in bash prompt
Date: Mon, 30 Oct 2006 11:32:44 +0100 [thread overview]
Message-ID: <200610301132.45086.robin.rosenberg@dewire.com> (raw)
In-Reply-To: <4545CC6F.90001@tromer.org>
måndag 30 oktober 2006 10:57 skrev Eran Tromer:
> That's an annoying 430ms delay at every prompt, on my box. Does StGIT do
> something expensive on every invocation?
I don't type fast enough to notice really and my machine seems faster, ~300 ms
per prompt.
>
> Ben Clifford'd solution is pretty much instantaneous, and the following
> extends it to StGIT (in a less clean but much faster way):
>
> ----------------------------------------------
> __prompt_githead() {
> __PS_GIT="$(git-symbolic-ref HEAD 2>/dev/null)" || exit
> __PS_GIT="$(basename $__PS_GIT)"
> echo -n " $__PS_GIT"
> __PS_GIT=$(cat "${GIT_DIR:-.git}/patches/$__PS_GIT/current" \
> 2>/dev/null) || exit
> echo -n ":$__PS_GIT"
> }
> PS1='[\u@\h \W$(__prompt_githead)]\$ '
> ----------------------------------------------
This doesn't work if the branch have a / in the name or if you are in a
subdirectory, not the top level. Probably not hard to fix though.
next prev parent reply other threads:[~2006-10-30 10:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-29 23:37 [StGIT PATCH] Bash snippet to show branch and patch in bash prompt Robin Rosenberg
2006-10-30 9:57 ` Eran Tromer
2006-10-30 10:24 ` Catalin Marinas
2006-10-30 10:32 ` Robin Rosenberg [this message]
2006-10-30 10:59 ` [PATCH] " Robin Rosenberg
2006-10-30 15:03 ` Eran Tromer
2006-11-02 11:24 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200610301132.45086.robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git2eran@tromer.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).