[PATCH] Add bare repository indicator for __git_ps1

Previous thread: none

Next thread: Re: pre-commit hook by Junio C Hamano on Friday, February 20, 2009 - 9:25 am. (6 messages)
From: Marius Storm-Olsen
Date: Friday, February 20, 2009 - 7:56 am

Prefixes the branch name with "BARE:" if you're in a
bare repository.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
---
 Patch tried sent via ThunderGit extension. Sorry if it's mangled :-)

 contrib/completion/git-completion.bash |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0a3092f..c741203 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -138,10 +138,16 @@ __git_ps1 ()
 			fi
 		fi
 
+		local c
+		
+		if test "$(git config --bool core.bare)" == "true"; then
+			c="BARE:"
+		fi
+
 		if [ -n "${1-}" ]; then
-			printf "$1" "${b##refs/heads/}$w$i$r"
+			printf "$1" "$c${b##refs/heads/}$w$i$r"
 		else
-			printf " (%s)" "${b##refs/heads/}$w$i$r"
+			printf " (%s)" "$c${b##refs/heads/}$w$i$r"
 		fi
 	fi
 }
-- 
1.6.2.rc1.20.g8c5b


--

From: Johannes Schindelin
Date: Friday, February 20, 2009 - 9:35 am

Hi,


Indeed, it seems that this got mangled, unfortunately.

Ciao,
Dscho
--

From: Thomas Rast
Date: Friday, February 20, 2009 - 9:46 am

Actually it seems the patch itself is fine, but the mail is still
flagged format=3Dflowed, so f=3Df-aware readers will mangle it on display.

It conflicts with e5dd864 (completion: Better __git_ps1 support when
not in working directory, 2009-02-11) however, which is on next.

=2D-=20
Thomas Rast
trast@{inf,student}.ethz.ch
From: Michael J Gruber
Date: Friday, February 20, 2009 - 10:13 am

Unmangled here also, viewing with TB, f-f disabled or not, unless I make
the window very small of course.

Michael
--

From: Marius Storm-Olsen
Date: Friday, February 20, 2009 - 3:04 pm

Hmm, it looks ok for me as well, though I do see the incorrect 
format=flowed for this unflowed mail. I think it's one of my other 
extensions causing this, but I'm not sure. I need to disable them to 

Ok, I think I was based on master. I'll rebase and do fixups on Monday.

Thanks!

--
.marius
--

From: Michael J Gruber
Date: Friday, February 20, 2009 - 9:39 am

Now what's that ThunderGit thingy? ;)

Seriously, I see you and Dscho have been carrying this on, and soon
external commands may be lauched. Is this going in a git specific
direction rather than attaching patch files unmangled (UnflowedTB)?

Michael
--

From: Marius Storm-Olsen
Date: Friday, February 20, 2009 - 2:55 pm

Well, Dscho's intentions was, as the project name says, to simply send 
patches unflowed. I have, however, had many other features which I 
would like to see in a Git extension, which is why called it 
ThunderGit instead. First I want the extension to help with Best 
Practices for sending patches. Second, I want the extension to have 
neatness like:

   1) Saving a whole patch series as a mailbox, for easy apply. Maybe
      even a "create new branch based on <branch>, and apply series"
      feature? ^shrug^

   2) Send patch (series) based on a selected email
      (ie. setting "references" based on selection)

   3) Showing Git patches with diff coloring (maybe also in the
      editor, but mostly for received mails)

   4) Basic validation of patch before sending, like
      a) trailing whitespace
      b) consistent preceding whitespaces
      c) <add favorite>

This is my first extension though, so any help from people "in the 
know" would be great!

If all attempts fail to make the extension fool proof wrt sending 
proper unflowed patches, we could always just use Thunderbird as the 
front-end for 'git send-email' ;-) I'm almost tempted to already go 
that route, simply to avoid all the hassle. Then we could also just 
use the plaintext composer, instead of the HTML composer which isn't 
exactly "fool proof" for plaintext patches.

--
.marius

--

From: Ted Pavlic
Date: Friday, February 20, 2009 - 10:06 am

> +		if test "$(git config --bool core.bare)" == "true"; then

As discussed in another thread, to be consistent with local coding 
convention, "test" should be replaced with "[ ... ]".

Additionally, double equality (==) should be replaced with single 
equality (=).

--Ted

-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.
--

From: Marius Storm-Olsen
Date: Friday, February 20, 2009 - 3:00 pm

Ok, I think I was based off of master at the time. I'll take a closer 
look. Thanks!

--
.marius
--

Previous thread: none

Next thread: Re: pre-commit hook by Junio C Hamano on Friday, February 20, 2009 - 9:25 am. (6 messages)