# [PATCH] Add bare repository indicator for __git_ps1

9 messages from 2009-02-20 to 2009-02-20. Participants: Marius Storm-Olsen, Johannes Schindelin, Michael J Gruber, Thomas Rast, Ted Pavlic.
Thread: https://gitlist.dev/t/17922

## Marius Storm-Olsen, 2009-02-20 14:56

Subject: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499EC48B.9070004@trolltech.com>
URL: https://gitlist.dev/e/499EC48B.9070004%40trolltech.com

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

```

## Johannes Schindelin, 2009-02-20 16:35

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <alpine.DEB.1.00.0902201734450.6302@intel-tinevez-2-302>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0902201734450.6302%40intel-tinevez-2-302
In-Reply-To: <499EC48B.9070004@trolltech.com>

```
Hi,

On Fri, 20 Feb 2009, Marius Storm-Olsen wrote:

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

Indeed, it seems that this got mangled, unfortunately.

Ciao,
Dscho

```

## Michael J Gruber, 2009-02-20 16:39

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499EDCCC.3030700@drmicha.warpmail.net>
URL: https://gitlist.dev/e/499EDCCC.3030700%40drmicha.warpmail.net
In-Reply-To: <499EC48B.9070004@trolltech.com>

```
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> rv:1.8.1.19) Gecko/20081209 Lightning/0.9 Thunderbird/2.0.0.19
> ThunderGit/0.1a Mnenhy/0.7.6.666

Marius Storm-Olsen venit, vidit, dixit 20.02.2009 15:56:
> 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 :-)

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

```

## Thomas Rast, 2009-02-20 16:46

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <200902201746.15242.trast@student.ethz.ch>
URL: https://gitlist.dev/e/200902201746.15242.trast%40student.ethz.ch
In-Reply-To: <alpine.DEB.1.00.0902201734450.6302@intel-tinevez-2-302>

```
Johannes Schindelin wrote:
> Hi,
> 
> On Fri, 20 Feb 2009, Marius Storm-Olsen wrote:
> 
> > +		local c
> > +		+		if test "$(git config --bool core.bare)" ==
> > "true"; then
> 
> Indeed, it seems that this got mangled, unfortunately.

Actually it seems the patch itself is fine, but the mail is still
flagged format=flowed, so f=f-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.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

```

## Ted Pavlic, 2009-02-20 17:06

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499EE324.4050305@tedpavlic.com>
URL: https://gitlist.dev/e/499EE324.4050305%40tedpavlic.com
In-Reply-To: <499EC48B.9070004@trolltech.com>

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

```

## Michael J Gruber, 2009-02-20 17:13

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499EE49C.1070707@drmicha.warpmail.net>
URL: https://gitlist.dev/e/499EE49C.1070707%40drmicha.warpmail.net
In-Reply-To: <200902201746.15242.trast@student.ethz.ch>

```
Thomas Rast venit, vidit, dixit 20.02.2009 17:46:
> Johannes Schindelin wrote:
>> Hi,
>>
>> On Fri, 20 Feb 2009, Marius Storm-Olsen wrote:
>>
>>> +		local c
>>> +		+		if test "$(git config --bool core.bare)" ==
>>> "true"; then
>> Indeed, it seems that this got mangled, unfortunately.
> 
> Actually it seems the patch itself is fine, but the mail is still
> flagged format=flowed, so f=f-aware readers will mangle it on display.

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

Michael

```

## Marius Storm-Olsen, 2009-02-20 21:55

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499F26E8.5090105@trolltech.com>
URL: https://gitlist.dev/e/499F26E8.5090105%40trolltech.com
In-Reply-To: <499EDCCC.3030700@drmicha.warpmail.net>

```
Michael J Gruber said the following on 20.02.2009 17:39:
>> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
>> rv:1.8.1.19) Gecko/20081209 Lightning/0.9 Thunderbird/2.0.0.19
>> ThunderGit/0.1a Mnenhy/0.7.6.666

Heh, you noticed the user-agent extra \o/ :-)


> Marius Storm-Olsen venit, vidit, dixit 20.02.2009 15:56:
>> 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
>> :-)
> 
> 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)?

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

```

## Marius Storm-Olsen, 2009-02-20 22:00

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499F27F9.8090506@trolltech.com>
URL: https://gitlist.dev/e/499F27F9.8090506%40trolltech.com
In-Reply-To: <499EE324.4050305@tedpavlic.com>

```
Ted Pavlic said the following on 20.02.2009 18:06:
>> +		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 (=).

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

--
.marius

```

## Marius Storm-Olsen, 2009-02-20 22:04

Subject: Re: [PATCH] Add bare repository indicator for __git_ps1
Message-ID: <499F28FF.30905@trolltech.com>
URL: https://gitlist.dev/e/499F28FF.30905%40trolltech.com
In-Reply-To: <200902201746.15242.trast@student.ethz.ch>

```
Thomas Rast said the following on 20.02.2009 17:46:
> Johannes Schindelin wrote:
>> On Fri, 20 Feb 2009, Marius Storm-Olsen wrote:
>>> +		local c
>>> +		+		if test "$(git config --bool core.bare)" ==
>>> "true"; then
>> Indeed, it seems that this got mangled, unfortunately.
> 
> Actually it seems the patch itself is fine, but the mail is still 
> flagged format=flowed, so f=f-aware readers will mangle it on
> display.

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


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

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

Thanks!

--
.marius

```
