threads / patch / 17922

patchAdd bare repository indicator for __git_ps1

Subject: [PATCH] Add bare repository indicator for __git_ps1

## tl;dr

9 messages between Feb 20, 2009 and Feb 20, 2009. Diffs are folded; open one to read it.

replies: 8people: 5as markdown or json

Marius Storm-Olsen· Feb 20, 2009, 14:56 UTC · lore

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(-)
Show changes to contrib/completion/git-completion.bash +8 −2
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· Feb 20, 2009, 16:35 UTC · re: Marius Storm-Olsen · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

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

Thomas Rast· Feb 20, 2009, 16:46 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

Johannes Schindelin wrote:
Show 9 quoted lines
> 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
Michael J Gruber· Feb 20, 2009, 17:13 UTC · re: Thomas Rast · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

Thomas Rast venit, vidit, dixit 20.02.2009 17:46:
Show 12 quoted lines
> 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· Feb 20, 2009, 22:04 UTC · re: Thomas Rast · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

Thomas Rast said the following on 20.02.2009 17:46:
Show 10 quoted lines
> 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

Michael J Gruber· Feb 20, 2009, 16:39 UTC · re: Marius Storm-Olsen · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

> 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:
Show 5 quoted lines
> 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
Marius Storm-Olsen· Feb 20, 2009, 21:55 UTC · re: Michael J Gruber · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

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/ :-)
Show 13 quoted lines
> 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

Ted Pavlic· Feb 20, 2009, 17:06 UTC · re: Marius Storm-Olsen · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

> +		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.
Marius Storm-Olsen· Feb 20, 2009, 22:00 UTC · re: Ted Pavlic · lore

Re: [PATCH] Add bare repository indicator for __git_ps1

Ted Pavlic said the following on 20.02.2009 18:06:
Show 7 quoted lines
>> +		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

← back to recent threads