* [PATCH] Add bare repository indicator for __git_ps1
@ 2009-02-20 14:56 Marius Storm-Olsen
2009-02-20 16:35 ` Johannes Schindelin
` (2 more replies)
0 siblings, 3 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-20 14:56 UTC (permalink / raw)
To: spearce; +Cc: Git Mailing List
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
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 14:56 Marius Storm-Olsen
@ 2009-02-20 16:35 ` Johannes Schindelin
2009-02-20 16:46 ` Thomas Rast
2009-02-20 16:39 ` Michael J Gruber
2009-02-20 17:06 ` Ted Pavlic
2 siblings, 1 reply; 27+ messages in thread
From: Johannes Schindelin @ 2009-02-20 16:35 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: spearce, Git Mailing List
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 14:56 Marius Storm-Olsen
2009-02-20 16:35 ` Johannes Schindelin
@ 2009-02-20 16:39 ` Michael J Gruber
2009-02-20 21:55 ` Marius Storm-Olsen
2009-02-20 17:06 ` Ted Pavlic
2 siblings, 1 reply; 27+ messages in thread
From: Michael J Gruber @ 2009-02-20 16:39 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Johannes Schindelin, Git Mailing List
> 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 16:35 ` Johannes Schindelin
@ 2009-02-20 16:46 ` Thomas Rast
2009-02-20 17:13 ` Michael J Gruber
2009-02-20 22:04 ` Marius Storm-Olsen
0 siblings, 2 replies; 27+ messages in thread
From: Thomas Rast @ 2009-02-20 16:46 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Marius Storm-Olsen, spearce, Git Mailing List
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 14:56 Marius Storm-Olsen
2009-02-20 16:35 ` Johannes Schindelin
2009-02-20 16:39 ` Michael J Gruber
@ 2009-02-20 17:06 ` Ted Pavlic
2009-02-20 22:00 ` Marius Storm-Olsen
2 siblings, 1 reply; 27+ messages in thread
From: Ted Pavlic @ 2009-02-20 17:06 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: spearce, Git Mailing List
> + 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.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 16:46 ` Thomas Rast
@ 2009-02-20 17:13 ` Michael J Gruber
2009-02-20 22:04 ` Marius Storm-Olsen
1 sibling, 0 replies; 27+ messages in thread
From: Michael J Gruber @ 2009-02-20 17:13 UTC (permalink / raw)
To: Thomas Rast
Cc: Johannes Schindelin, Marius Storm-Olsen, spearce,
Git Mailing List
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 16:39 ` Michael J Gruber
@ 2009-02-20 21:55 ` Marius Storm-Olsen
0 siblings, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-20 21:55 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Johannes Schindelin, Git Mailing List
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 17:06 ` Ted Pavlic
@ 2009-02-20 22:00 ` Marius Storm-Olsen
0 siblings, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-20 22:00 UTC (permalink / raw)
To: Ted Pavlic; +Cc: spearce, Git Mailing List
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-20 16:46 ` Thomas Rast
2009-02-20 17:13 ` Michael J Gruber
@ 2009-02-20 22:04 ` Marius Storm-Olsen
1 sibling, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-20 22:04 UTC (permalink / raw)
To: Thomas Rast; +Cc: Johannes Schindelin, spearce, Git Mailing List
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] Add bare repository indicator for __git_ps1
@ 2009-02-21 14:48 Marius Storm-Olsen
2009-02-21 14:53 ` Marius Storm-Olsen
2009-02-21 19:29 ` Junio C Hamano
0 siblings, 2 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-21 14:48 UTC (permalink / raw)
To: spearce; +Cc: git, Marius Storm-Olsen
Prefixes the branch name with "BARE:" if you're in a
bare repository.
Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
---
Ok, had some free cycles, so here's fixed up version.
Based on next this time
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 ec587d2..e585d40 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -135,11 +135,17 @@ __git_ps1 ()
fi
fi
+ local c
+
+ if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
+ c="BARE:"
+ fi
+
if [ -n "$b" ]; then
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
fi
--
1.6.2.rc1.20.g8c5b
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-21 14:48 [PATCH] Add bare repository indicator for __git_ps1 Marius Storm-Olsen
@ 2009-02-21 14:53 ` Marius Storm-Olsen
2009-02-21 19:29 ` Junio C Hamano
1 sibling, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-21 14:53 UTC (permalink / raw)
To: spearce; +Cc: git
Marius Storm-Olsen said the following on 21.02.2009 15:48:
> Prefixes the branch name with "BARE:" if you're in a
> bare repository.
>
> Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
> ---
> Ok, had some free cycles, so here's fixed up version.
> Based on next this time
*grmbl* This is v2 of the patch, of course.
--
.marius
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-21 14:48 [PATCH] Add bare repository indicator for __git_ps1 Marius Storm-Olsen
2009-02-21 14:53 ` Marius Storm-Olsen
@ 2009-02-21 19:29 ` Junio C Hamano
2009-02-21 19:43 ` Marius Storm-Olsen
1 sibling, 1 reply; 27+ messages in thread
From: Junio C Hamano @ 2009-02-21 19:29 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: spearce, git
Marius Storm-Olsen <git@storm-olsen.com> writes:
> Prefixes the branch name with "BARE:" if you're in a
> bare repository.
The updated code may correctly detect when you are in such a situation,
but I have to wonder why anybody would even want to be reminded that he is
in a bare repository to begin with.
For doing any usual work of growing history, you would work inside a
repository with an work tree. The only occasion you would *go* to a bare
repository would be to tweak, futz with and fix one that is used as a
distribution point, isn't it? You usually update such a repository by
pushing into it, so your being there would be a result of very conscious
act of chdir'ing into it yourself, and you wouldn't be spending too much
time in there anyway.
There may be a different workflow where you would stay in a bare
repository for an extended period of time and you would benefit from such
a reminder like this patch adds, but I do not think of one.
Care to enlighten?
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-21 19:29 ` Junio C Hamano
@ 2009-02-21 19:43 ` Marius Storm-Olsen
2009-02-22 16:49 ` Junio C Hamano
2009-02-23 15:42 ` Shawn O. Pearce
0 siblings, 2 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-21 19:43 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Marius Storm-Olsen, spearce, git
Junio C Hamano said the following on 21.02.2009 20:29:
> Marius Storm-Olsen <git@storm-olsen.com> writes:
>> Prefixes the branch name with "BARE:" if you're in a bare
>> repository.
>
> The updated code may correctly detect when you are in such a
> situation, but I have to wonder why anybody would even want to be
> reminded that he is in a bare repository to begin with.
Yeah I just noticed that, when I got some few cycles to spare. So I
pushed out a v3 of that patch *sigh*
> For doing any usual work of growing history, you would work inside
> a repository with an work tree. The only occasion you would *go*
> to a bare repository would be to tweak, futz with and fix one that
> is used as a distribution point, isn't it? You usually update such
> a repository by pushing into it, so your being there would be a
> result of very conscious act of chdir'ing into it yourself, and you
> wouldn't be spending too much time in there anyway.
>
> There may be a different workflow where you would stay in a bare
> repository for an extended period of time and you would benefit
> from such a reminder like this patch adds, but I do not think of
> one.
>
> Care to enlighten?
Right, I have quite a few repos on my machine which are just bare, as
I use them gather branches and push out again.
(http://repo.or.cz/w/git/platforms.git is one of them) However, it's
probably just me, since I could just as easily put them in a proper
directory structure to indicate their bareness.
Anyways, I just thought it would fairly "low cost" to add, and nice to
have.
Consider it, as Linus coined the term, a throw-away patch. I can
easily put it in my .bashrc instead. :)
--
.marius
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-21 19:43 ` Marius Storm-Olsen
@ 2009-02-22 16:49 ` Junio C Hamano
2009-02-23 7:52 ` Marius Storm-Olsen
2009-02-23 15:42 ` Shawn O. Pearce
1 sibling, 1 reply; 27+ messages in thread
From: Junio C Hamano @ 2009-02-22 16:49 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Marius Storm-Olsen, spearce, git
Marius Storm-Olsen <marius@trolltech.com> writes:
>> For doing any usual work of growing history, you would work inside
>> a repository with an work tree. The only occasion you would *go*
>> to a bare repository would be to tweak, futz with and fix one that
>> is used as a distribution point, isn't it? You usually update such
>> a repository by pushing into it, so your being there would be a
>> result of very conscious act of chdir'ing into it yourself, and you
>> wouldn't be spending too much time in there anyway.
>>
>> There may be a different workflow where you would stay in a bare
>> repository for an extended period of time and you would benefit
>> from such a reminder like this patch adds, but I do not think of
>> one.
>>
>> Care to enlighten?
>
> Right, I have quite a few repos on my machine which are just bare, as I
> use them gather branches and push out
> again. (http://repo.or.cz/w/git/platforms.git is one of them) However,
> it's probably just me, since I could just as easily put them in a proper
> directory structure to indicate their bareness.
Ah, so "gather branches and push out again" would look something like
this?
$ cd /pub/some/where/platforms.git
$ git fetch platform1 ;# perhaps with master:one/master mapping
$ git fetch platform2 ;# perhaps with master:two/master
$ git push public
Then it is very understandable that you would spend time inside a bare
repository. I do not understand the need for GIT_DIR! thing even less,
but since we have that there already, I do not see a reason not to add
this to the queue.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-22 16:49 ` Junio C Hamano
@ 2009-02-23 7:52 ` Marius Storm-Olsen
0 siblings, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-23 7:52 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Marius Storm-Olsen, spearce, git
[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]
Junio C Hamano said the following on 22.02.2009 17:49:
> Marius Storm-Olsen <marius@trolltech.com> writes:
>>> There may be a different workflow where you would stay in a
>>> bare repository for an extended period of time and you would
>>> benefit from such a reminder like this patch adds, but I do not
>>> think of one.
>>>
>>> Care to enlighten?
>> Right, I have quite a few repos on my machine which are just
>> bare, as I use them gather branches and push out again.
>> (http://repo.or.cz/w/git/platforms.git is one of them) However,
>> it's probably just me, since I could just as easily put them in a
>> proper directory structure to indicate their bareness.
>
> Ah, so "gather branches and push out again" would look something
> like this?
>
> $ cd /pub/some/where/platforms.git
> $ git fetch platform1 ;# perhaps with master:one/master mapping
> $ git fetch platform2 ;# perhaps with master:two/master
> $ git push public
>
> Then it is very understandable that you would spend time inside a
> bare repository. I do not understand the need for GIT_DIR! thing
> even less, but since we have that there already, I do not see a
> reason not to add this to the queue.
Indeed that's somewhat how I work.
Also, given the new GIT_DIR! "feature", I cannot simply keep my
"BARE:" in my own .bash_rc anymore, since then I'd just get
(BARE:GIT_DIR!)
which is less than useful. So, given that the overhead and impact to
the current logic is minimal, I would appreciate the patch being queued.
Thanks!
--
.marius [@trolltech.com]
'if you know what you're doing, it's not research'
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-21 19:43 ` Marius Storm-Olsen
2009-02-22 16:49 ` Junio C Hamano
@ 2009-02-23 15:42 ` Shawn O. Pearce
2009-02-23 16:03 ` Marius Storm-Olsen
1 sibling, 1 reply; 27+ messages in thread
From: Shawn O. Pearce @ 2009-02-23 15:42 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Junio C Hamano, Marius Storm-Olsen, git
Marius Storm-Olsen <marius@trolltech.com> wrote:
> Junio C Hamano said the following on 21.02.2009 20:29:
>> Marius Storm-Olsen <git@storm-olsen.com> writes:
>>> Prefixes the branch name with "BARE:" if you're in a bare
>>> repository.
>
>> There may be a different workflow where you would stay in a bare
>> repository for an extended period of time and you would benefit
>> from such a reminder like this patch adds, but I do not think of
>> one.
>
> Right, I have quite a few repos on my machine which are just bare, as I
> use them gather branches and push out again.
> (http://repo.or.cz/w/git/platforms.git is one of them) However, it's
> probably just me, since I could just as easily put them in a proper
> directory structure to indicate their bareness.
>
> Anyways, I just thought it would fairly "low cost" to add, and nice to
> have.
Its not that low of a cost, its an extra fork+exec per prompt when in
a .git/ or a bare repository. Neither is very common when compared
to a workdir, Junio's right about that. But its YAFE. ;)
> Consider it, as Linus coined the term, a throw-away patch. I can easily
> put it in my .bashrc instead. :)
Like Junio, I'm not very compelled to include this patch. I just
don't see enough to make including it worthwhile.
--
Shawn.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-23 15:42 ` Shawn O. Pearce
@ 2009-02-23 16:03 ` Marius Storm-Olsen
2009-02-23 16:16 ` Shawn O. Pearce
0 siblings, 1 reply; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-23 16:03 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Junio C Hamano, Marius Storm-Olsen, git
[-- Attachment #1: Type: text/plain, Size: 1774 bytes --]
Shawn O. Pearce said the following on 23.02.2009 16:42:
> Marius Storm-Olsen <marius@trolltech.com> wrote:
>> Anyways, I just thought it would fairly "low cost" to add, and
>> nice to have.
>
> Its not that low of a cost, its an extra fork+exec per prompt when
> in a .git/ or a bare repository. Neither is very common when
> compared to a workdir, Junio's right about that. But its YAFE. ;)
>
>> Consider it, as Linus coined the term, a throw-away patch. I can
>> easily put it in my .bashrc instead. :)
>
> Like Junio, I'm not very compelled to include this patch. I just
> don't see enough to make including it worthwhile.
If so, then I'd like to argue to remove setting the fake "GIT_DIR!"
branch in the ps, since it hinders me from constructing this, IMO
useful prompt, "(BARE:master)" in my own .bashrc.
~/source/some_repo (GIT_DIR!)$
simply isn't useful to me, and neither is
~/source/some_repo (BARE:GIT_DIR!)$
of course. Now, if we remove setting the fake branch
~/source/some_repo (BARE:some/funky/branch)$
is doable for me in my own .bashrc, and by your argument, it would
also make it more light weight, since you'd remove one extra fork+exec
for *every single prompt* (and not just one extra when inside GIT_DIR).
^shrug^ at this point you and Junio can discuss what to do, as Junio
already said
| "I do not understand the need for GIT_DIR! thing even
| less, but since we have that there already, I do not
| see a reason not to add this to the queue."
And I have to agree with him. At this point, __git_ps1() is actually
removing useful information from the prompt; at least it does for me.
--
.marius [@trolltech.com]
'if you know what you're doing, it's not research'
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-23 16:03 ` Marius Storm-Olsen
@ 2009-02-23 16:16 ` Shawn O. Pearce
2009-02-23 18:55 ` Marius Storm-Olsen
2009-02-24 1:35 ` Junio C Hamano
0 siblings, 2 replies; 27+ messages in thread
From: Shawn O. Pearce @ 2009-02-23 16:16 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Junio C Hamano, Marius Storm-Olsen, git
Marius Storm-Olsen <marius@trolltech.com> wrote:
>
> ^shrug^ at this point you and Junio can discuss what to do, as Junio
> already said
>
> | "I do not understand the need for GIT_DIR! thing even
> | less, but since we have that there already, I do not
> | see a reason not to add this to the queue."
>
> And I have to agree with him. At this point, __git_ps1() is actually
> removing useful information from the prompt; at least it does for me.
*sigh*
OK. I guess we include it then.
Acked-by: Shawn O. Pearce <spearce@spearce.org>
--
Shawn.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-23 16:16 ` Shawn O. Pearce
@ 2009-02-23 18:55 ` Marius Storm-Olsen
2009-02-24 1:35 ` Junio C Hamano
1 sibling, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-23 18:55 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Junio C Hamano, Marius Storm-Olsen, git
Shawn O. Pearce said the following on 23.02.2009 17:16:
> Marius Storm-Olsen <marius@trolltech.com> wrote:
>> ^shrug^ at this point you and Junio can discuss what to do, as Junio
>> already said
>>
>> | "I do not understand the need for GIT_DIR! thing even
>> | less, but since we have that there already, I do not
>> | see a reason not to add this to the queue."
>>
>> And I have to agree with him. At this point, __git_ps1() is actually
>> removing useful information from the prompt; at least it does for me.
>
> *sigh*
Ops, I realize that it sounded like I was setting you two up against
each other, which was not my intention! What I meant to say was, I've
stated my case as clear as i can now, so you two can make a decision.
I know Junio will listen to you, and I'd be fine if you said no, based
on all the info I gave you. (Though I really didn't like the
"GIT_DIR!"-branch, but oh well)
> OK. I guess we include it then.
>
> Acked-by: Shawn O. Pearce <spearce@spearce.org>
Thanks, and again, sorry if you felt I put you up against Junio!
--
.marius
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-23 16:16 ` Shawn O. Pearce
2009-02-23 18:55 ` Marius Storm-Olsen
@ 2009-02-24 1:35 ` Junio C Hamano
2009-02-24 14:25 ` Ted Pavlic
1 sibling, 1 reply; 27+ messages in thread
From: Junio C Hamano @ 2009-02-24 1:35 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Marius Storm-Olsen, Marius Storm-Olsen, git
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Marius Storm-Olsen <marius@trolltech.com> wrote:
>>
>> ^shrug^ at this point you and Junio can discuss what to do, as Junio
>> already said
>>
>> | "I do not understand the need for GIT_DIR! thing even
>> | less, but since we have that there already, I do not
>> | see a reason not to add this to the queue."
>>
>> And I have to agree with him. At this point, __git_ps1() is actually
>> removing useful information from the prompt; at least it does for me.
>
> *sigh*
>
> OK. I guess we include it then.
>
> Acked-by: Shawn O. Pearce <spearce@spearce.org>
Reverting GIT_DIR! ugliness is certainly a possibility. As long as people
who chdir into there are the only ones who suffer from the ugliness I do
not particularly care that much, though ;-)
Will apply anyway.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-24 1:35 ` Junio C Hamano
@ 2009-02-24 14:25 ` Ted Pavlic
2009-02-24 14:46 ` Marius Storm-Olsen
0 siblings, 1 reply; 27+ messages in thread
From: Ted Pavlic @ 2009-02-24 14:25 UTC (permalink / raw)
To: Junio C Hamano
Cc: Shawn O. Pearce, Marius Storm-Olsen, Marius Storm-Olsen, git
> Reverting GIT_DIR! ugliness is certainly a possibility. As long as people
> who chdir into there are the only ones who suffer from the ugliness I do
> not particularly care that much, though ;-)
>
> Will apply anyway.
I only added the "GIT_DIR!" on the advice of Junio, who suggested a
"danger" flag. I asked for suggestions on replacement text.
Keep in mind that "BARE:master" doesn't make much sense. If you're in a
git dir, you don't have a working directory. "BARE" alone makes sense.
Personally, I think it makes more sense to submit a patch that changes
"GIT_DIR!" to "BARE" in the bare case (and doesn't print any branch).
--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.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-24 14:25 ` Ted Pavlic
@ 2009-02-24 14:46 ` Marius Storm-Olsen
2009-02-24 15:39 ` Ted Pavlic
0 siblings, 1 reply; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-24 14:46 UTC (permalink / raw)
To: Ted Pavlic; +Cc: Junio C Hamano, Shawn O. Pearce, Marius Storm-Olsen, git
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
Ted Pavlic said the following on 24.02.2009 15:25:
> I only added the "GIT_DIR!" on the advice of Junio, who suggested a
> "danger" flag. I asked for suggestions on replacement text.
>
> Keep in mind that "BARE:master" doesn't make much sense. If you're
> in a git dir, you don't have a working directory. "BARE" alone
> makes sense. Personally, I think it makes more sense to submit a
> patch that changes "GIT_DIR!" to "BARE" in the bare case (and
> doesn't print any branch).
It reflects what HEAD points to in the bare repository.
--
.marius [@trolltech.com]
'if you know what you're doing, it's not research'
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-24 14:46 ` Marius Storm-Olsen
@ 2009-02-24 15:39 ` Ted Pavlic
2009-02-24 17:01 ` Junio C Hamano
0 siblings, 1 reply; 27+ messages in thread
From: Ted Pavlic @ 2009-02-24 15:39 UTC (permalink / raw)
To: Marius Storm-Olsen
Cc: Junio C Hamano, Shawn O. Pearce, Marius Storm-Olsen, git
>> Keep in mind that "BARE:master" doesn't make much sense. If you're
>
> It reflects what HEAD points to in the bare repository.
Obviously, but that seems disingenuous when you're inside the git dir.
"HEAD" is supposed to reflect the name of the currently checked-out
branch, and so it is tied to a working directory. I'm not sure why it's
useful to show $GIT_DIR/HEAD in PS1 while inside .git as it invites
operations that probably should not be done while within the bare repo.
--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.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-24 15:39 ` Ted Pavlic
@ 2009-02-24 17:01 ` Junio C Hamano
2009-02-24 19:47 ` Marius Storm-Olsen
0 siblings, 1 reply; 27+ messages in thread
From: Junio C Hamano @ 2009-02-24 17:01 UTC (permalink / raw)
To: Ted Pavlic; +Cc: Marius Storm-Olsen, Shawn O. Pearce, Marius Storm-Olsen, git
Ted Pavlic <ted@tedpavlic.com> writes:
>>> Keep in mind that "BARE:master" doesn't make much sense. If you're
>>
>> It reflects what HEAD points to in the bare repository.
>
> Obviously, but that seems disingenuous when you're inside the git
> dir. "HEAD" is supposed to reflect the name of the currently
> checked-out branch, and so it is tied to a working directory. I'm not
> sure why it's useful to show $GIT_DIR/HEAD in PS1 while inside .git as
> it invites operations that probably should not be done while within
> the bare repo.
It still indicates the branch in interest. That's the one you get a
checkout for when you clone from the repository.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-24 17:01 ` Junio C Hamano
@ 2009-02-24 19:47 ` Marius Storm-Olsen
2009-02-25 6:08 ` Junio C Hamano
0 siblings, 1 reply; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-24 19:47 UTC (permalink / raw)
To: Junio C Hamano
Cc: Ted Pavlic, Marius Storm-Olsen, Shawn O. Pearce,
Marius Storm-Olsen, git
Junio C Hamano said the following on 24.02.2009 18:01:
> Ted Pavlic <ted@tedpavlic.com> writes:
>>>> Keep in mind that "BARE:master" doesn't make much sense. If
>>>> you're
>>> It reflects what HEAD points to in the bare repository.
>> Obviously, but that seems disingenuous when you're inside the git
>> dir. "HEAD" is supposed to reflect the name of the currently
>> checked-out branch, and so it is tied to a working directory. I'm
>> not sure why it's useful to show $GIT_DIR/HEAD in PS1 while
>> inside .git as it invites operations that probably should not be
>> done while within the bare repo.
>
> It still indicates the branch in interest. That's the one you get
> a checkout for when you clone from the repository.
Junio, unfortunately you applied the incorrect version.
It was v3 (Message-Id:
<1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the
correct one, since it's the one that avoids the "GIT_DIR!" in a bare
repo. :-/
--
.marius
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-24 19:47 ` Marius Storm-Olsen
@ 2009-02-25 6:08 ` Junio C Hamano
2009-02-25 6:46 ` Marius Storm-Olsen
0 siblings, 1 reply; 27+ messages in thread
From: Junio C Hamano @ 2009-02-25 6:08 UTC (permalink / raw)
To: Marius Storm-Olsen
Cc: Ted Pavlic, Marius Storm-Olsen, Shawn O. Pearce,
Marius Storm-Olsen, git
Marius Storm-Olsen <marius@storm-olsen.com> writes:
> Junio, unfortunately you applied the incorrect version.
>
> It was v3 (Message-Id:
> <1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the
> correct one, since it's the one that avoids the "GIT_DIR!" in a bare
> repo. :-/
Sorry, I only was looking at the thread that had Shawn's Ack.
Is this interdiff as a fix-up Ok?
-- >8 --
Subject: [PATCH] Fixup: Add bare repository indicator for __git_ps1
Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
contrib/completion/git-completion.bash | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a61d852..dd393cd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -117,9 +117,14 @@ __git_ps1 ()
local w
local i
+ local c
if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
- b="GIT_DIR!"
+ if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
+ c="BARE:"
+ else
+ b="GIT_DIR!"
+ fi
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
@@ -135,12 +140,6 @@ __git_ps1 ()
fi
fi
- local c
-
- if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
- c="BARE:"
- fi
-
if [ -n "$b" ]; then
if [ -n "${1-}" ]; then
printf "$1" "$c${b##refs/heads/}$w$i$r"
--
1.6.2.rc1.113.ga620b
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] Add bare repository indicator for __git_ps1
2009-02-25 6:08 ` Junio C Hamano
@ 2009-02-25 6:46 ` Marius Storm-Olsen
0 siblings, 0 replies; 27+ messages in thread
From: Marius Storm-Olsen @ 2009-02-25 6:46 UTC (permalink / raw)
To: Junio C Hamano
Cc: Ted Pavlic, Marius Storm-Olsen, Shawn O. Pearce,
Marius Storm-Olsen, git
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
Junio C Hamano said the following on 25.02.2009 07:08:
> Marius Storm-Olsen <marius@storm-olsen.com> writes:
>> Junio, unfortunately you applied the incorrect version.
>>
>> It was v3 (Message-Id:
>> <1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the
>> correct one, since it's the one that avoids the "GIT_DIR!" in a bare
>> repo. :-/
>
> Sorry, I only was looking at the thread that had Shawn's Ack.
> Is this interdiff as a fix-up Ok?
Yup, looks sane to me. Thanks.
--
.marius
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2009-02-25 6:48 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-21 14:48 [PATCH] Add bare repository indicator for __git_ps1 Marius Storm-Olsen
2009-02-21 14:53 ` Marius Storm-Olsen
2009-02-21 19:29 ` Junio C Hamano
2009-02-21 19:43 ` Marius Storm-Olsen
2009-02-22 16:49 ` Junio C Hamano
2009-02-23 7:52 ` Marius Storm-Olsen
2009-02-23 15:42 ` Shawn O. Pearce
2009-02-23 16:03 ` Marius Storm-Olsen
2009-02-23 16:16 ` Shawn O. Pearce
2009-02-23 18:55 ` Marius Storm-Olsen
2009-02-24 1:35 ` Junio C Hamano
2009-02-24 14:25 ` Ted Pavlic
2009-02-24 14:46 ` Marius Storm-Olsen
2009-02-24 15:39 ` Ted Pavlic
2009-02-24 17:01 ` Junio C Hamano
2009-02-24 19:47 ` Marius Storm-Olsen
2009-02-25 6:08 ` Junio C Hamano
2009-02-25 6:46 ` Marius Storm-Olsen
-- strict thread matches above, loose matches on Subject: below --
2009-02-20 14:56 Marius Storm-Olsen
2009-02-20 16:35 ` Johannes Schindelin
2009-02-20 16:46 ` Thomas Rast
2009-02-20 17:13 ` Michael J Gruber
2009-02-20 22:04 ` Marius Storm-Olsen
2009-02-20 16:39 ` Michael J Gruber
2009-02-20 21:55 ` Marius Storm-Olsen
2009-02-20 17:06 ` Ted Pavlic
2009-02-20 22:00 ` Marius Storm-Olsen
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).