git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] contrib/completion: remove parentheses from prompt
@ 2011-04-22 19:32 Kim Phillips
  2011-04-22 22:32 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Kim Phillips @ 2011-04-22 19:32 UTC (permalink / raw)
  To: git

Save horizontal terminal line real estate by removing
parentheses from the prompt branch display.  The branch
is already sufficiently visually delimited by the preceding
space character.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
 contrib/completion/git-completion.bash |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 840ae38..1373fd4 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -268,7 +268,6 @@ __git_ps1 ()
 
 				b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
 				b="unknown"
-				b="($b)"
 			}
 		fi
 
@@ -312,7 +311,7 @@ __git_ps1 ()
 		fi
 
 		local f="$w$i$s$u"
-		printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
+		printf "${1:- %s}" "$c${b##refs/heads/}${f:+ $f}$r$p"
 	fi
 }
 
-- 
1.7.4.5.2.g95442

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] contrib/completion: remove parentheses from prompt
  2011-04-22 19:32 [PATCH] contrib/completion: remove parentheses from prompt Kim Phillips
@ 2011-04-22 22:32 ` Junio C Hamano
  2011-04-22 23:43   ` Kim Phillips
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2011-04-22 22:32 UTC (permalink / raw)
  To: Kim Phillips; +Cc: git

Kim Phillips <kim.phillips@freescale.com> writes:

> Save horizontal terminal line real estate by removing parentheses from
> the prompt branch display.  The branch is already sufficiently visually
> delimited by the preceding space character.

That changes behaviour and makes people who like the current output
unhappy, no?  For example, I have

	PS1=': \h \W$(__git_ps1 "/%s"); '

and from it I get these output:

	: host git.git/master;
	: host git.git/(v1.7.5-rc3);
        : host git.git/(63e4ee5...);

I do like the fact that the tagname v1.7.5-rc3 is parenthesized---it makes
it very clear that I am not on any branch while being detached.

Of course that is _my_ personal taste, but I wonder if you can remove the
parentheses by changing the way you use __git_ps1 in your PS1 definition.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] contrib/completion: remove parentheses from prompt
  2011-04-22 22:32 ` Junio C Hamano
@ 2011-04-22 23:43   ` Kim Phillips
  0 siblings, 0 replies; 3+ messages in thread
From: Kim Phillips @ 2011-04-22 23:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Shawn O. Pearce

On Fri, 22 Apr 2011 15:32:27 -0700
Junio C Hamano <gitster@pobox.com> wrote:

> Kim Phillips <kim.phillips@freescale.com> writes:
> 
> > Save horizontal terminal line real estate by removing parentheses from
> > the prompt branch display.  The branch is already sufficiently visually
> > delimited by the preceding space character.
> 
> That changes behaviour and makes people who like the current output
> unhappy, no?  For example, I have
> 
> 	PS1=': \h \W$(__git_ps1 "/%s"); '
> 
> and from it I get these output:
> 
> 	: host git.git/master;
> 	: host git.git/(v1.7.5-rc3);
>         : host git.git/(63e4ee5...);
> 
> I do like the fact that the tagname v1.7.5-rc3 is parenthesized---it makes
> it very clear that I am not on any branch while being detached.
> 
> Of course that is _my_ personal taste, but I wonder if you can remove the
> parentheses by changing the way you use __git_ps1 in your PS1 definition.

Oh I see what happened.  A long time ago I had changed the recommended
PS1 from the top of git-completion.bash to a version without the
parentheses, but I must've started working in detached states more
recently until finally _my_ personal distaste for parens kicked in
again.

Fwiw, especially on properly managed projects, the content of the name
itself is enough to distinguish a branch name from a tag name (which
usually contains a version value), from a raw sha followed by three
dots.  But I'd understand if people want it to be more deterministic.

Thanks,

Kim

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-22 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-22 19:32 [PATCH] contrib/completion: remove parentheses from prompt Kim Phillips
2011-04-22 22:32 ` Junio C Hamano
2011-04-22 23:43   ` Kim Phillips

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