Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH] Pass options to underlying git-rev-list from show-branches.
Date: Tue, 16 Aug 2005 22:34:10 -0700	[thread overview]
Message-ID: <7vzmrh2kkt.fsf@assigned-by-dhcp.cox.net> (raw)

This lets you say "git show-branches --max-count=30".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

    And this is how --symbolic is used to pick out the named rev
    parameters.

 git-show-branches-script |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

34ac753b1b26d52ac502ec6ca5c2eb021818cfaa
diff --git a/git-show-branches-script b/git-show-branches-script
--- a/git-show-branches-script
+++ b/git-show-branches-script
@@ -5,15 +5,23 @@
 
 . git-sh-setup-script || die "Not a git repository"
 
+usage () {
+    die "usage: $0 <ref>..."
+}
+
 headref=`readlink $GIT_DIR/HEAD`
-case "$#" in
-0)
-	set x `cd $GIT_DIR/refs &&
-	    find heads -type f -print |
-	    sed -e 's|heads/||' |
-	    sort`
+
+case "$(git-rev-parse --no-revs)" in '') ;; *) usage ;; esac
+revs=$(git-rev-parse --revs-only --symbolic --no-flags "$@")
+flags=$(git-rev-parse --revs-only --flags "$@")
+case "$revs" in
+'')
+	revs=$(git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' |
+	       sort)
 	shift ;;
 esac
+set x $revs
+shift
 
 hh= in=
 for ref
@@ -22,7 +30,7 @@ do
 	*/"$ref") H='*' ;;
 	*) H='!' ;;
 	esac
-	h=`git-rev-parse --verify "$ref^0"` || exit
+	h=`git-rev-parse --verify "$ref^0" 2>/dev/null` || continue
 	l=`git-log-script --max-count=1 --pretty=oneline "$h" |
 		sed -e 's/^[^ ]* //'`
 	hh="$hh $h"
@@ -32,7 +40,7 @@ done
 set x $hh
 shift
 
-git-rev-list --pretty=oneline "$@" |
+git-rev-list --pretty=oneline $flags $@ |
 while read v l
 do
 	in=''

                 reply	other threads:[~2005-08-17  5:34 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=7vzmrh2kkt.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --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