git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string
Date: Sat, 11 May 2013 21:55:12 +0530	[thread overview]
Message-ID: <1368289513-8700-2-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1368289513-8700-1-git-send-email-artagnon@gmail.com>

Nobody has branch names that end with + or *.  Then why put a space
after the branch name and before [*|+][=|<|>] in the prompt string?

Before this, your prompt might have looked like:

    artagnon|master *=:~/src/git$

Now, it will look like:

    artagnon|master*=:~/src/git$

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 contrib/completion/git-prompt.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index eaf5c36..08c9b22 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -383,9 +383,6 @@ __git_ps1 ()
 				# is necessary to prevent wrapping issues!
 				gitstring="\[$branch_color\]$branchstring\[$c_clear\]"
 
-				if [ -n "$w$i$s$u$r$p" ]; then
-					gitstring="$gitstring "
-				fi
 				if [ "$w" = "*" ]; then
 					gitstring="$gitstring\[$bad_color\]$w"
 				fi
@@ -400,13 +397,13 @@ __git_ps1 ()
 				fi
 				gitstring="$gitstring\[$c_clear\]$r$p"
 			else
-				gitstring="$c${b##refs/heads/}${f:+ $f}$r$p"
+				gitstring="$c${b##refs/heads/}${f:+$f}$r$p"
 			fi
 			gitstring=$(printf -- "$printf_format" "$gitstring")
 			PS1="$ps1pc_start$gitstring$ps1pc_end"
 		else
 			# NO color option unless in PROMPT_COMMAND mode
-			printf -- "$printf_format" "$c${b##refs/heads/}${f:+ $f}$r$p"
+			printf -- "$printf_format" "$c${b##refs/heads/}${f:+$f}$r$p"
 		fi
 	fi
 }
-- 
1.8.3.rc1.52.g4537cf1

  reply	other threads:[~2013-05-11 16:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-11 16:25 [PATCH 0/2] Colored prompt for zsh Ramkumar Ramachandra
2013-05-11 16:25 ` Ramkumar Ramachandra [this message]
2013-05-13  4:57   ` [PATCH 1/2] git-prompt.sh: strip unnecessary space in prompt string Junio C Hamano
2013-05-13  7:40     ` Ramkumar Ramachandra
2013-05-13  9:17       ` SZEDER Gábor
2013-05-13 10:13         ` Ramkumar Ramachandra
2013-05-13 11:05           ` SZEDER Gábor
2013-05-13 11:11             ` SZEDER Gábor
2013-05-13 13:58               ` Junio C Hamano
2013-05-13 14:21                 ` Ramkumar Ramachandra
2013-05-11 16:25 ` [PATCH 2/2] git-prompt.zsh: introduce thin ZSH wrapper Ramkumar Ramachandra
2013-05-11 21:26   ` Felipe Contreras
2013-05-11 22:18     ` [PATCH v2] git-prompt.sh: colorize ZSH prompt Ramkumar Ramachandra
2013-05-11 22:29       ` Felipe Contreras
2013-05-11 22:40         ` Ramkumar Ramachandra
2013-05-11 23:06           ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368289513-8700-2-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).