All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Vilz <niv@iaglans.de>
To: Sean <seanlkml@sympatico.ca>
Cc: git@vger.kernel.org, Theodore Tso <tytso@mit.edu>
Subject: Re: git-PS1 bash prompt setting
Date: Fri, 17 Nov 2006 09:38:02 +0100	[thread overview]
Message-ID: <20061117083801.GB11468@fry.bender.fht> (raw)
In-Reply-To: <20061116130111.921396df.seanlkml@sympatico.ca>

On Thu, Nov 16, 2006 at 01:01:11PM -0500, Sean wrote:

> [branch!repo/relative/path]$ 
> 
> Where "repo" is the basename of the path to the root of your repo.
> An example would look like this:
> 
> [master!linus-2.6/Documentation/vm]$ 
> 
> Cheers,
> Sean
> 
> 
> #!/bin/bash
> BR=$(git symbolic-ref HEAD 2>/dev/null) || { echo "$@" ; exit ; }
> BR=${BR#refs/heads/}
> REL=$(git rev-parse --show-prefix) 
> REL="${REL//%\/}"
> LOC="${PWD%/$REL}"
> echo "[$BR!${LOC/*\/}${REL:+/$REL}]$ "

Just a note:

this doesn't work with bash 3.2. I think they altered the way of
trimming variables in this version.

on systems with bash 3.2 installed, i get
[master!linus-2.6/vm/vm]$ 
with the example above.

on systems with bash 3.1, it works properly.

unfortunatelly, i am not so good in bash scripting, so it will take some
time for me to fix it.

Sincerly

       reply	other threads:[~2006-11-17  8:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20061116130111.921396df.seanlkml@sympatico.ca>
2006-11-17  8:38 ` Nicolas Vilz [this message]
2006-11-17  9:20   ` git-PS1 bash prompt setting Sean
2006-11-19  6:28     ` Junio C Hamano
     [not found]   ` <20061117042051.d2fbddb6.seanlkml@sympatico.ca>
2006-11-17  9:52     ` Nicolas Vilz
2006-11-16 18:01 Sean
2006-11-16 18:35 ` Junio C Hamano
2006-11-26 14:27 ` Johannes Schindelin
2006-11-26 14:42   ` Sean
2006-11-26 15:18     ` Johannes Schindelin
     [not found]   ` <20061126094212.fde8cce7.seanlkml@sympatico.ca>
2006-11-26 15:05     ` Nicolas Vilz
2006-11-27  8:48       ` Junio C Hamano
2006-11-27 10:50         ` Nicolas Vilz
2006-11-27  6:54     ` Shawn Pearce
2006-11-27  7:49       ` Jakub Narebski
2006-11-27 12:56       ` Sean
     [not found]       ` <20061127075650.81a5a850.seanlkml@sympatico.ca>
2006-11-27 17:02         ` Shawn Pearce
2006-11-27 17:38           ` Sean

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=20061117083801.GB11468@fry.bender.fht \
    --to=niv@iaglans.de \
    --cc=git@vger.kernel.org \
    --cc=seanlkml@sympatico.ca \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.