{"thread":{"id":"1550","subject":"[PATCH] Pass options to underlying git-rev-list from show-branches.","startedAt":"2005-08-17T05:34:10Z","lastAt":"2005-08-17T05:34:10Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7421","messageId":"7vzmrh2kkt.fsf@assigned-by-dhcp.cox.net","threadId":"1550","inReplyTo":null,"subject":"[PATCH] Pass options to underlying git-rev-list from show-branches.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-17T05:34:10Z","receivedAt":"2005-08-17T05:34:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This lets you say \"git show-branches --max-count=30\".\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n    And this is how --symbolic is used to pick out the named rev\n    parameters.\n\n git-show-branches-script |   24 ++++++++++++++++--------\n 1 files changed, 16 insertions(+), 8 deletions(-)\n\n34ac753b1b26d52ac502ec6ca5c2eb021818cfaa\ndiff --git a/git-show-branches-script b/git-show-branches-script\n--- a/git-show-branches-script\n+++ b/git-show-branches-script\n@@ -5,15 +5,23 @@\n \n . git-sh-setup-script || die \"Not a git repository\"\n \n+usage () {\n+    die \"usage: $0 <ref>...\"\n+}\n+\n headref=`readlink $GIT_DIR/HEAD`\n-case \"$#\" in\n-0)\n-\tset x `cd $GIT_DIR/refs &&\n-\t    find heads -type f -print |\n-\t    sed -e 's|heads/||' |\n-\t    sort`\n+\n+case \"$(git-rev-parse --no-revs)\" in '') ;; *) usage ;; esac\n+revs=$(git-rev-parse --revs-only --symbolic --no-flags \"$@\")\n+flags=$(git-rev-parse --revs-only --flags \"$@\")\n+case \"$revs\" in\n+'')\n+\trevs=$(git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' |\n+\t       sort)\n \tshift ;;\n esac\n+set x $revs\n+shift\n \n hh= in=\n for ref\n@@ -22,7 +30,7 @@ do\n \t*/\"$ref\") H='*' ;;\n \t*) H='!' ;;\n \tesac\n-\th=`git-rev-parse --verify \"$ref^0\"` || exit\n+\th=`git-rev-parse --verify \"$ref^0\" 2>/dev/null` || continue\n \tl=`git-log-script --max-count=1 --pretty=oneline \"$h\" |\n \t\tsed -e 's/^[^ ]* //'`\n \thh=\"$hh $h\"\n@@ -32,7 +40,7 @@ done\n set x $hh\n shift\n \n-git-rev-list --pretty=oneline \"$@\" |\n+git-rev-list --pretty=oneline $flags $@ |\n while read v l\n do\n \tin=''\n"}]}