git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Show [xxxx] suffix after non-"heads" branches in git-branch output
Date: Thu, 26 Oct 2006 09:18:05 +0100	[thread overview]
Message-ID: <200610260918.05952.andyparkins@gmail.com> (raw)

This patch changes from showing only those refs in "heads/" to all non-"tags/"
refs.

For any ref that isn't a "heads/" ref (like "remotes/") a suffix of "[xxx]" is
added to the line.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
This patch is in preference to my earlier "Use "up/" prefix for all the 
upstream branches" patch.  Junio pointed out that that patch wasn't necessary 
because git already supports the "--use-separate-remote" option.  This patch 
makes git-branch always show all the branches that are useable as references 
in tree-ish, but highlights the remote branches.

 git-branch.sh |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/git-branch.sh b/git-branch.sh
index f823c78..bddd189 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -87,17 +87,28 @@ done
 
 case "$#" in
 0)
-	git-rev-parse --symbolic --branches |
+	git-rev-parse --symbolic --all |
 	sort |
-	while read ref
+	grep -v "^refs/tags" |
+	sed -ne 's|^refs/\([^/]*\)/\(.*\)|\1 \2|p' |
+	while read type ref
 	do
+		case "$type" in
+		heads)
+			type=""
+			;;
+		*)
+			type=" [$type]"
+			;;
+		esac
+
 		if test "$headref" = "$ref"
 		then
 			pfx='*'
 		else
 			pfx=' '
 		fi
-		echo "$pfx $ref"
+		echo "$pfx $ref$type"
 	done
 	exit 0 ;;
 1)
-- 
1.4.2.3

                 reply	other threads:[~2006-10-26  8:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200610260918.05952.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /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).