From: Lars Hjemli <hjemli@gmail.com>
To: git@vger.kernel.org
Cc: Lars Hjemli <hjemli@gmail.com>
Subject: [PATCH] Add -v option to git-branch.sh
Date: Sat, 21 Oct 2006 13:32:36 +0200
Date: Sat, 21 Oct 2006 13:09:09 +0200 [thread overview]
Message-ID: <11614303561903-git-send-email-hjemli@gmail.com> (raw)
Teach git-branch to show sha1 and subject for each branch tip.
This requires branch names to be max 20 chars for the output to be
properly aligned. Not optimal, but doing an extra pass just to find
the longest name didn't seem reasonable either.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
git-branch.sh | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/git-branch.sh b/git-branch.sh
index 4379a07..6a425e0 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'
+USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r | -v'
LONG_USAGE='If no arguments, show available branches and mark current branch with a star.
If one argument, create a new branch <branchname> based off of current HEAD.
If two arguments, create a new branch <branchname> based off of <start-point>.'
@@ -56,6 +56,7 @@ ls_remote_branches () {
force=
create_log=
+verbose=
while case "$#,$1" in 0,*) break ;; *,-*) ;; *) break ;; esac
do
case "$1" in
@@ -73,6 +74,9 @@ do
-l)
create_log="yes"
;;
+ -v)
+ verbose="yes"
+ ;;
--)
shift
break
@@ -96,7 +100,13 @@ case "$#" in
else
pfx=' '
fi
- echo "$pfx $ref"
+ if test "$verbose" = "yes"
+ then
+ log=$(git-log --max-count=1 --pretty=oneline $ref)
+ printf "%s %-20s %s\n" "$pfx" "$ref" "$log"
+ else
+ echo "$pfx $ref"
+ fi
done
exit 0 ;;
1)
--
1.4.3.ge193
reply other threads:[~2006-10-21 11:32 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=11614303561903-git-send-email-hjemli@gmail.com \
--to=hjemli@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).