{"thread":{"id":"5981","subject":"[PATCH] Add -v option to git-branch.sh","startedAt":"2006-10-21T11:32:36Z","lastAt":"2006-10-21T11:32:36Z","messageCount":1,"participants":["Lars Hjemli"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"29487","messageId":"11614303561903-git-send-email-hjemli@gmail.com","threadId":"5981","inReplyTo":null,"subject":"[PATCH] Add -v option to git-branch.sh","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-10-21T11:32:36Z","receivedAt":"2006-10-21T11:32:36Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Teach git-branch to show sha1 and subject for each branch tip. \n\nThis requires branch names to be max 20 chars for the output to be \nproperly aligned. Not optimal, but doing an extra pass just to find \nthe longest name didn't seem reasonable either.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n git-branch.sh |   14 ++++++++++++--\n 1 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/git-branch.sh b/git-branch.sh\nindex 4379a07..6a425e0 100755\n--- a/git-branch.sh\n+++ b/git-branch.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n \n-USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'\n+USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r | -v'\n LONG_USAGE='If no arguments, show available branches and mark current branch with a star.\n If one argument, create a new branch <branchname> based off of current HEAD.\n If two arguments, create a new branch <branchname> based off of <start-point>.'\n@@ -56,6 +56,7 @@ ls_remote_branches () {\n \n force=\n create_log=\n+verbose=\n while case \"$#,$1\" in 0,*) break ;; *,-*) ;; *) break ;; esac\n do\n \tcase \"$1\" in\n@@ -73,6 +74,9 @@ do\n \t-l)\n \t\tcreate_log=\"yes\"\n \t\t;;\n+\t-v)\n+\t\tverbose=\"yes\"\n+\t\t;;\n \t--)\n \t\tshift\n \t\tbreak\n@@ -96,7 +100,13 @@ case \"$#\" in\n \t\telse\n \t\t\tpfx=' '\n \t\tfi\n-\t\techo \"$pfx $ref\"\n+\t\tif test \"$verbose\" = \"yes\"\n+\t\tthen\n+\t\t\tlog=$(git-log --max-count=1 --pretty=oneline $ref)\n+\t\t\tprintf \"%s %-20s %s\\n\" \"$pfx\" \"$ref\" \"$log\"\n+\t\telse\n+\t\t\techo \"$pfx $ref\"\n+\t\tfi\n \tdone\n \texit 0 ;;\n 1)\n-- \n1.4.3.ge193\n"}]}