{"thread":{"id":"17940","subject":"[PATCH v3] Add bare repository indicator for __git_ps1","startedAt":"2009-02-21T19:20:57Z","lastAt":"2009-02-21T19:20:57Z","messageCount":1,"participants":["Marius Storm-Olsen"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"105737","messageId":"1235244057-16912-1-git-send-email-git@storm-olsen.com","threadId":"17940","inReplyTo":null,"subject":"[PATCH v3] Add bare repository indicator for __git_ps1","fromName":"Marius Storm-Olsen","fromEmail":"git@storm-olsen.com","sentAt":"2009-02-21T19:20:57Z","receivedAt":"2009-02-21T19:20:57Z","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 Well there you go. That's what you get for not testing your\n patch after a rebase.. another version. ;-)\n\n Next had progressed into handling the --inside-git-dir case,\n and would replace branch name with \"GIT_DIR!\". Now, that's\n not so useful when that GIT_DIR! is a bare repository, so\n this version will prefix the branch name with \"BARE:\"\n instead.\n\n contrib/completion/git-completion.bash |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ec587d2..90ba428 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@@ -137,9 +142,9 @@ __git_ps1 ()\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.rc0.5.gf970\n"}]}