{"thread":{"id":"17936","subject":"[PATCH] Add bare repository indicator for __git_ps1","startedAt":"2009-02-21T14:48:43Z","lastAt":"2009-02-25T06:46:45Z","messageCount":18,"participants":["Marius Storm-Olsen","Junio C Hamano","Shawn O. Pearce","Ted Pavlic"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"105720","messageId":"1235227723-11471-1-git-send-email-git@storm-olsen.com","threadId":"17936","inReplyTo":null,"subject":"[PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"git@storm-olsen.com","sentAt":"2009-02-21T14:48:43Z","receivedAt":"2009-02-21T14:48:43Z","isPatch":true,"sender":{"key":"git@storm-olsen.com","avatar":null},"body":"Prefixes the branch name with \"BARE:\" if you're in a\nbare repository.\n\nSigned-off-by: Marius Storm-Olsen <git@storm-olsen.com>\n---\n Ok, had some free cycles, so here's fixed up version.\n Based on next this time\n\n contrib/completion/git-completion.bash |   10 ++++++++--\n 1 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ec587d2..e585d40 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -135,11 +135,17 @@ __git_ps1 ()\n \t\t\tfi\n \t\tfi\n \n+\t\tlocal c\n+\n+\t\tif [ \"true\" = \"$(git config --bool core.bare 2>/dev/null)\" ]; then\n+\t\t\tc=\"BARE:\"\n+\t\tfi\n+\n \t\tif [ -n \"$b\" ]; then\n \t\t\tif [ -n \"${1-}\" ]; then\n-\t\t\t\tprintf \"$1\" \"${b##refs/heads/}$w$i$r\"\n+\t\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n \t\t\telse\n-\t\t\t\tprintf \" (%s)\" \"${b##refs/heads/}$w$i$r\"\n+\t\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n \t\t\tfi\n \t\tfi\n \tfi\n-- \n1.6.2.rc1.20.g8c5b\n"},{"id":"105721","messageId":"49A01553.9020608@storm-olsen.com","threadId":"17936","inReplyTo":"1235227723-11471-1-git-send-email-git@storm-olsen.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-02-21T14:53:07Z","receivedAt":"2009-02-21T14:53:07Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Marius Storm-Olsen said the following on 21.02.2009 15:48:\n> Prefixes the branch name with \"BARE:\" if you're in a\n> bare repository.\n> \n> Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>\n> ---\n>  Ok, had some free cycles, so here's fixed up version.\n>  Based on next this time\n\n*grmbl* This is v2 of the patch, of course.\n\n--\n.marius\n"},{"id":"105739","messageId":"7v8wnzr3k9.fsf@gitster.siamese.dyndns.org","threadId":"17936","inReplyTo":"1235227723-11471-1-git-send-email-git@storm-olsen.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-21T19:29:58Z","receivedAt":"2009-02-21T19:29:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <git@storm-olsen.com> writes:\n\n> Prefixes the branch name with \"BARE:\" if you're in a\n> bare repository.\n\nThe updated code may correctly detect when you are in such a situation,\nbut I have to wonder why anybody would even want to be reminded that he is\nin a bare repository to begin with.\n\nFor doing any usual work of growing history, you would work inside a\nrepository with an work tree.  The only occasion you would *go* to a bare\nrepository would be to tweak, futz with and fix one that is used as a\ndistribution point, isn't it?  You usually update such a repository by\npushing into it, so your being there would be a result of very conscious\nact of chdir'ing into it yourself, and you wouldn't be spending too much\ntime in there anyway.\n\nThere may be a different workflow where you would stay in a bare\nrepository for an extended period of time and you would benefit from such\na reminder like this patch adds, but I do not think of one.\n\nCare to enlighten?\n"},{"id":"105741","messageId":"49A05958.7050703@trolltech.com","threadId":"17936","inReplyTo":"7v8wnzr3k9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-21T19:43:20Z","receivedAt":"2009-02-21T19:43:20Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 21.02.2009 20:29:\n> Marius Storm-Olsen <git@storm-olsen.com> writes:\n>> Prefixes the branch name with \"BARE:\" if you're in a bare\n>> repository.\n> \n> The updated code may correctly detect when you are in such a\n> situation, but I have to wonder why anybody would even want to be\n> reminded that he is in a bare repository to begin with.\n\nYeah I just noticed that, when I got some few cycles to spare. So I \npushed out a v3 of that patch *sigh*\n\n> For doing any usual work of growing history, you would work inside\n> a repository with an work tree.  The only occasion you would *go*\n> to a bare repository would be to tweak, futz with and fix one that\n> is used as a distribution point, isn't it?  You usually update such\n> a repository by pushing into it, so your being there would be a\n> result of very conscious act of chdir'ing into it yourself, and you\n> wouldn't be spending too much time in there anyway.\n> \n> There may be a different workflow where you would stay in a bare \n> repository for an extended period of time and you would benefit\n> from such a reminder like this patch adds, but I do not think of\n> one.\n> \n> Care to enlighten?\n\nRight, I have quite a few repos on my machine which are just bare, as \nI use them gather branches and push out again. \n(http://repo.or.cz/w/git/platforms.git is one of them) However, it's \nprobably just me, since I could just as easily put them in a proper \ndirectory structure to indicate their bareness.\n\nAnyways, I just thought it would fairly \"low cost\" to add, and nice to \nhave.\n\nConsider it, as Linus coined the term, a throw-away patch. I can \neasily put it in my .bashrc instead. :)\n\n--\n.marius\n"},{"id":"105780","messageId":"7v63j22z92.fsf@gitster.siamese.dyndns.org","threadId":"17936","inReplyTo":"49A05958.7050703@trolltech.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-22T16:49:13Z","receivedAt":"2009-02-22T16:49:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n>> For doing any usual work of growing history, you would work inside\n>> a repository with an work tree.  The only occasion you would *go*\n>> to a bare repository would be to tweak, futz with and fix one that\n>> is used as a distribution point, isn't it?  You usually update such\n>> a repository by pushing into it, so your being there would be a\n>> result of very conscious act of chdir'ing into it yourself, and you\n>> wouldn't be spending too much time in there anyway.\n>>\n>> There may be a different workflow where you would stay in a bare\n>> repository for an extended period of time and you would benefit\n>> from such a reminder like this patch adds, but I do not think of\n>> one.\n>>\n>> Care to enlighten?\n>\n> Right, I have quite a few repos on my machine which are just bare, as I\n> use them gather branches and push out\n> again. (http://repo.or.cz/w/git/platforms.git is one of them) However,\n> it's probably just me, since I could just as easily put them in a proper\n> directory structure to indicate their bareness.\n\nAh, so \"gather branches and push out again\" would look something like\nthis?\n\n    $ cd /pub/some/where/platforms.git\n    $ git fetch platform1 ;# perhaps with master:one/master mapping\n    $ git fetch platform2 ;# perhaps with master:two/master\n    $ git push public\n\nThen it is very understandable that you would spend time inside a bare\nrepository.  I do not understand the need for GIT_DIR! thing even less,\nbut since we have that there already, I do not see a reason not to add\nthis to the queue.\n"},{"id":"105878","messageId":"49A255BF.5040905@trolltech.com","threadId":"17936","inReplyTo":"7v63j22z92.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-23T07:52:31Z","receivedAt":"2009-02-23T07:52:31Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 22.02.2009 17:49:\n> Marius Storm-Olsen <marius@trolltech.com> writes:\n>>> There may be a different workflow where you would stay in a\n>>> bare repository for an extended period of time and you would\n>>> benefit from such a reminder like this patch adds, but I do not\n>>> think of one.\n>>> \n>>> Care to enlighten?\n>> Right, I have quite a few repos on my machine which are just\n>> bare, as I use them gather branches and push out again.\n>> (http://repo.or.cz/w/git/platforms.git is one of them) However, \n>> it's probably just me, since I could just as easily put them in a\n>> proper directory structure to indicate their bareness.\n> \n> Ah, so \"gather branches and push out again\" would look something\n> like this?\n> \n>     $ cd /pub/some/where/platforms.git\n>     $ git fetch platform1 ;# perhaps with master:one/master mapping\n>     $ git fetch platform2 ;# perhaps with master:two/master\n>     $ git push public\n> \n> Then it is very understandable that you would spend time inside a\n> bare repository.  I do not understand the need for GIT_DIR! thing\n> even less, but since we have that there already, I do not see a\n> reason not to add this to the queue.\n\nIndeed that's somewhat how I work.\nAlso, given the new GIT_DIR! \"feature\", I cannot simply keep my \n\"BARE:\" in my own .bash_rc anymore, since then I'd just get\n     (BARE:GIT_DIR!)\nwhich is less than useful. So, given that the overhead and impact to \nthe current logic is minimal, I would appreciate the patch being queued.\n\nThanks!\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"105904","messageId":"20090223154237.GH22848@spearce.org","threadId":"17936","inReplyTo":"49A05958.7050703@trolltech.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-02-23T15:42:37Z","receivedAt":"2009-02-23T15:42:37Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> wrote:\n> Junio C Hamano said the following on 21.02.2009 20:29:\n>> Marius Storm-Olsen <git@storm-olsen.com> writes:\n>>> Prefixes the branch name with \"BARE:\" if you're in a bare\n>>> repository.\n>\n>> There may be a different workflow where you would stay in a bare  \n>> repository for an extended period of time and you would benefit\n>> from such a reminder like this patch adds, but I do not think of\n>> one.\n>\n> Right, I have quite a few repos on my machine which are just bare, as I \n> use them gather branches and push out again.  \n> (http://repo.or.cz/w/git/platforms.git is one of them) However, it's  \n> probably just me, since I could just as easily put them in a proper  \n> directory structure to indicate their bareness.\n>\n> Anyways, I just thought it would fairly \"low cost\" to add, and nice to  \n> have.\n\nIts not that low of a cost, its an extra fork+exec per prompt when in\na .git/ or a bare repository.  Neither is very common when compared\nto a workdir, Junio's right about that.  But its YAFE.  ;)\n\n> Consider it, as Linus coined the term, a throw-away patch. I can easily \n> put it in my .bashrc instead. :)\n\nLike Junio, I'm not very compelled to include this patch.  I just\ndon't see enough to make including it worthwhile.\n\n-- \nShawn.\n"},{"id":"105910","messageId":"49A2C8D1.3080104@trolltech.com","threadId":"17936","inReplyTo":"20090223154237.GH22848@spearce.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-23T16:03:29Z","receivedAt":"2009-02-23T16:03:29Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Shawn O. Pearce said the following on 23.02.2009 16:42:\n> Marius Storm-Olsen <marius@trolltech.com> wrote:\n>> Anyways, I just thought it would fairly \"low cost\" to add, and\n>> nice to have.\n> \n> Its not that low of a cost, its an extra fork+exec per prompt when\n> in a .git/ or a bare repository.  Neither is very common when\n> compared to a workdir, Junio's right about that.  But its YAFE.  ;)\n> \n>> Consider it, as Linus coined the term, a throw-away patch. I can\n>> easily put it in my .bashrc instead. :)\n> \n> Like Junio, I'm not very compelled to include this patch.  I just \n> don't see enough to make including it worthwhile.\n\nIf so, then I'd like to argue to remove setting the fake \"GIT_DIR!\" \nbranch in the ps, since it hinders me from constructing this, IMO \nuseful prompt, \"(BARE:master)\" in my own .bashrc.\n\n     ~/source/some_repo (GIT_DIR!)$\nsimply isn't useful to me, and neither is\n     ~/source/some_repo (BARE:GIT_DIR!)$\nof course. Now, if we remove setting the fake branch\n     ~/source/some_repo (BARE:some/funky/branch)$\nis doable for me in my own .bashrc, and by your argument, it would \nalso make it more light weight, since you'd remove one extra fork+exec \nfor *every single prompt* (and not just one extra when inside GIT_DIR).\n\n^shrug^ at this point you and Junio can discuss what to do, as Junio \nalready said\n\n   | \"I do not understand the need for GIT_DIR! thing even\n   |  less, but since we have that there already, I do not\n   |  see a reason not to add this to the queue.\"\n\nAnd I have to agree with him. At this point, __git_ps1() is actually \nremoving useful information from the prompt; at least it does for me.\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"105913","messageId":"20090223161657.GL22848@spearce.org","threadId":"17936","inReplyTo":"49A2C8D1.3080104@trolltech.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-02-23T16:16:57Z","receivedAt":"2009-02-23T16:16:57Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> wrote:\n>\n> ^shrug^ at this point you and Junio can discuss what to do, as Junio  \n> already said\n>\n>   | \"I do not understand the need for GIT_DIR! thing even\n>   |  less, but since we have that there already, I do not\n>   |  see a reason not to add this to the queue.\"\n>\n> And I have to agree with him. At this point, __git_ps1() is actually  \n> removing useful information from the prompt; at least it does for me.\n\n*sigh*\n\nOK.  I guess we include it then.\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n-- \nShawn.\n"},{"id":"105929","messageId":"49A2F122.7090607@trolltech.com","threadId":"17936","inReplyTo":"20090223161657.GL22848@spearce.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-23T18:55:30Z","receivedAt":"2009-02-23T18:55:30Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Shawn O. Pearce said the following on 23.02.2009 17:16:\n> Marius Storm-Olsen <marius@trolltech.com> wrote:\n>> ^shrug^ at this point you and Junio can discuss what to do, as Junio  \n>> already said\n>>\n>>   | \"I do not understand the need for GIT_DIR! thing even\n>>   |  less, but since we have that there already, I do not\n>>   |  see a reason not to add this to the queue.\"\n>>\n>> And I have to agree with him. At this point, __git_ps1() is actually  \n>> removing useful information from the prompt; at least it does for me.\n> \n> *sigh*\n\nOps, I realize that it sounded like I was setting you two up against \neach other, which was not my intention! What I meant to say was, I've \nstated my case as clear as i can now, so you two can make a decision. \nI know Junio will listen to you, and I'd be fine if you said no, based \non all the info I gave you. (Though I really didn't like the \n\"GIT_DIR!\"-branch, but oh well)\n\n\n> OK.  I guess we include it then.\n> \n> Acked-by: Shawn O. Pearce <spearce@spearce.org>\n\nThanks, and again, sorry if you felt I put you up against Junio!\n\n--\n.marius\n"},{"id":"105955","messageId":"7vab8cpqgl.fsf@gitster.siamese.dyndns.org","threadId":"17936","inReplyTo":"20090223161657.GL22848@spearce.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-24T01:35:06Z","receivedAt":"2009-02-24T01:35:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Marius Storm-Olsen <marius@trolltech.com> wrote:\n>>\n>> ^shrug^ at this point you and Junio can discuss what to do, as Junio  \n>> already said\n>>\n>>   | \"I do not understand the need for GIT_DIR! thing even\n>>   |  less, but since we have that there already, I do not\n>>   |  see a reason not to add this to the queue.\"\n>>\n>> And I have to agree with him. At this point, __git_ps1() is actually  \n>> removing useful information from the prompt; at least it does for me.\n>\n> *sigh*\n>\n> OK.  I guess we include it then.\n>\n> Acked-by: Shawn O. Pearce <spearce@spearce.org>\n\nReverting GIT_DIR! ugliness is certainly a possibility.  As long as people\nwho chdir into there are the only ones who suffer from the ugliness I do\nnot particularly care that much, though ;-)\n\nWill apply anyway.\n"},{"id":"106053","messageId":"49A40372.2060600@tedpavlic.com","threadId":"17936","inReplyTo":"7vab8cpqgl.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-02-24T14:25:54Z","receivedAt":"2009-02-24T14:25:54Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"> Reverting GIT_DIR! ugliness is certainly a possibility.  As long as people\n> who chdir into there are the only ones who suffer from the ugliness I do\n> not particularly care that much, though ;-)\n>\n> Will apply anyway.\n\nI only added the \"GIT_DIR!\" on the advice of Junio, who suggested a \n\"danger\" flag. I asked for suggestions on replacement text.\n\nKeep in mind that \"BARE:master\" doesn't make much sense. If you're in a \ngit dir, you don't have a working directory. \"BARE\" alone makes sense. \nPersonally, I think it makes more sense to submit a patch that changes \n\"GIT_DIR!\" to \"BARE\" in the bare case (and doesn't print any branch).\n\n--Ted\n\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"106054","messageId":"49A40858.6010108@trolltech.com","threadId":"17936","inReplyTo":"49A40372.2060600@tedpavlic.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-24T14:46:48Z","receivedAt":"2009-02-24T14:46:48Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Ted Pavlic said the following on 24.02.2009 15:25:\n> I only added the \"GIT_DIR!\" on the advice of Junio, who suggested a\n> \"danger\" flag. I asked for suggestions on replacement text.\n> \n> Keep in mind that \"BARE:master\" doesn't make much sense. If you're\n> in a git dir, you don't have a working directory. \"BARE\" alone\n> makes sense. Personally, I think it makes more sense to submit a\n> patch that changes \"GIT_DIR!\" to \"BARE\" in the bare case (and\n> doesn't print any branch).\n\nIt reflects what HEAD points to in the bare repository.\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"106062","messageId":"49A414B8.8010906@tedpavlic.com","threadId":"17936","inReplyTo":"49A40858.6010108@trolltech.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-02-24T15:39:36Z","receivedAt":"2009-02-24T15:39:36Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":">> Keep in mind that \"BARE:master\" doesn't make much sense. If you're\n>\n> It reflects what HEAD points to in the bare repository.\n\nObviously, but that seems disingenuous when you're inside the git dir. \n\"HEAD\" is supposed to reflect the name of the currently checked-out \nbranch, and so it is tied to a working directory. I'm not sure why it's \nuseful to show $GIT_DIR/HEAD in PS1 while inside .git as it invites \noperations that probably should not be done while within the bare repo.\n\n--Ted\n\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"106078","messageId":"7vljrvixa3.fsf@gitster.siamese.dyndns.org","threadId":"17936","inReplyTo":"49A414B8.8010906@tedpavlic.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-24T17:01:56Z","receivedAt":"2009-02-24T17:01:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ted Pavlic <ted@tedpavlic.com> writes:\n\n>>> Keep in mind that \"BARE:master\" doesn't make much sense. If you're\n>>\n>> It reflects what HEAD points to in the bare repository.\n>\n> Obviously, but that seems disingenuous when you're inside the git\n> dir. \"HEAD\" is supposed to reflect the name of the currently\n> checked-out branch, and so it is tied to a working directory. I'm not\n> sure why it's useful to show $GIT_DIR/HEAD in PS1 while inside .git as\n> it invites operations that probably should not be done while within\n> the bare repo.\n\nIt still indicates the branch in interest.  That's the one you get a\ncheckout for when you clone from the repository.\n"},{"id":"106098","messageId":"49A44EC6.3070800@storm-olsen.com","threadId":"17936","inReplyTo":"7vljrvixa3.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-02-24T19:47:18Z","receivedAt":"2009-02-24T19:47:18Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Junio C Hamano said the following on 24.02.2009 18:01:\n> Ted Pavlic <ted@tedpavlic.com> writes:\n>>>> Keep in mind that \"BARE:master\" doesn't make much sense. If\n>>>> you're\n>>> It reflects what HEAD points to in the bare repository.\n>> Obviously, but that seems disingenuous when you're inside the git\n>>  dir. \"HEAD\" is supposed to reflect the name of the currently \n>> checked-out branch, and so it is tied to a working directory. I'm\n>> not sure why it's useful to show $GIT_DIR/HEAD in PS1 while\n>> inside .git as it invites operations that probably should not be\n>> done while within the bare repo.\n> \n> It still indicates the branch in interest.  That's the one you get\n> a checkout for when you clone from the repository.\n\nJunio, unfortunately you applied the incorrect version.\n\nIt was v3 (Message-Id: \n<1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the \ncorrect one, since it's the one that avoids the \"GIT_DIR!\" in a bare \nrepo. :-/\n\n--\n.marius\n"},{"id":"106135","messageId":"7vk57fdp59.fsf@gitster.siamese.dyndns.org","threadId":"17936","inReplyTo":"49A44EC6.3070800@storm-olsen.com","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-25T06:08:50Z","receivedAt":"2009-02-25T06:08:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@storm-olsen.com> writes:\n\n> Junio, unfortunately you applied the incorrect version.\n>\n> It was v3 (Message-Id:\n> <1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the\n> correct one, since it's the one that avoids the \"GIT_DIR!\" in a bare\n> repo. :-/\n\nSorry, I only was looking at the thread that had Shawn's Ack.\nIs this interdiff as a fix-up Ok?\n\n-- >8 --\n\nSubject: [PATCH] Fixup: Add bare repository indicator for __git_ps1\n\nSigned-off-by: Marius Storm-Olsen <git@storm-olsen.com>\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/completion/git-completion.bash |   13 ++++++-------\n 1 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a61d852..dd393cd 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -117,9 +117,14 @@ __git_ps1 ()\n \n \t\tlocal w\n \t\tlocal i\n+\t\tlocal c\n \n \t\tif [ \"true\" = \"$(git rev-parse --is-inside-git-dir 2>/dev/null)\" ]; then\n-\t\t\tb=\"GIT_DIR!\"\n+\t\t\tif [ \"true\" = \"$(git config --bool core.bare 2>/dev/null)\" ]; then\n+\t\t\t\tc=\"BARE:\"\n+\t\t\telse\n+\t\t\t\tb=\"GIT_DIR!\"\n+\t\t\tfi\n \t\telif [ \"true\" = \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" ]; then\n \t\t\tif [ -n \"${GIT_PS1_SHOWDIRTYSTATE-}\" ]; then\n \t\t\t\tif [ \"$(git config --bool bash.showDirtyState)\" != \"false\" ]; then\n@@ -135,12 +140,6 @@ __git_ps1 ()\n \t\t\tfi\n \t\tfi\n \n-\t\tlocal c\n-\n-\t\tif [ \"true\" = \"$(git config --bool core.bare 2>/dev/null)\" ]; then\n-\t\t\tc=\"BARE:\"\n-\t\tfi\n-\n \t\tif [ -n \"$b\" ]; then\n \t\t\tif [ -n \"${1-}\" ]; then\n \t\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n-- \n1.6.2.rc1.113.ga620b\n"},{"id":"106139","messageId":"49A4E955.7000103@storm-olsen.com","threadId":"17936","inReplyTo":"7vk57fdp59.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-02-25T06:46:45Z","receivedAt":"2009-02-25T06:46:45Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Junio C Hamano said the following on 25.02.2009 07:08:\n> Marius Storm-Olsen <marius@storm-olsen.com> writes:\n>> Junio, unfortunately you applied the incorrect version.\n>>\n>> It was v3 (Message-Id:\n>> <1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the\n>> correct one, since it's the one that avoids the \"GIT_DIR!\" in a bare\n>> repo. :-/\n> \n> Sorry, I only was looking at the thread that had Shawn's Ack.\n> Is this interdiff as a fix-up Ok?\n\nYup, looks sane to me. Thanks.\n\n--\n.marius\n\n"}]}