{"thread":{"id":"5990","subject":"[PATCH 2/3] git-branch: Add -w option to adjust branchname column width","startedAt":"2006-10-21T22:33:21Z","lastAt":"2006-10-21T22:33:24Z","messageCount":4,"participants":["Lars Hjemli"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"29567","messageId":"1161470004894-git-send-email-hjemli@gmail.com","threadId":"5990","inReplyTo":null,"subject":"[PATCH 0/3] Extend git-branch list output","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-10-21T22:33:21Z","receivedAt":"2006-10-21T22:33:21Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"This patch-series is on top of my previous patch to git-branch.sh\n\nShortlog:\n [PATCH 1/3] Make git-branch honor -v when showing remote branches\n [PATCH 2/3] git-branch: Add -w option to adjust branchname column width\n [PATCH 3/3] Update documentation for git-branch\n\nDiffstat:\n Documentation/git-branch.txt |    8 ++++-\n git-branch.sh                |   79 +++++++++++++++++++++++++++--------------\n 2 files changed, 59 insertions(+), 28 deletions(-)\n"},{"id":"29565","messageId":"11614700063520-git-send-email-hjemli@gmail.com","threadId":"5990","inReplyTo":"1161470004894-git-send-email-hjemli@gmail.com","subject":"[PATCH 1/3] Make git-branch honor -v when showing remote branches","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-10-21T22:33:22Z","receivedAt":"2006-10-21T22:33:22Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n git-branch.sh |   74 ++++++++++++++++++++++++++++++++++++--------------------\n 1 files changed, 47 insertions(+), 27 deletions(-)\n\ndiff --git a/git-branch.sh b/git-branch.sh\nindex ab58737..25abd4c 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 | -v'\n+USAGE='[-r] [-v] | (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>]'\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@@ -48,15 +48,48 @@ If you are sure you want to delete it, r\n     exit 0\n }\n \n-ls_remote_branches () {\n-    git-rev-parse --symbolic --all |\n-    sed -ne 's|^refs/\\(remotes/\\)|\\1|p' |\n-    sort\n-}\n-\n force=\n create_log=\n verbose=\n+remotes=\n+\n+ls_remote_branches () {\n+\tgit-rev-parse --symbolic --all |\n+\tsed -ne 's|^refs/\\(remotes/\\)|\\1|p' |\n+\tsort |\n+\twhile read ref\n+\tdo\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 \"%-20s %s\\n\" \"$ref\" \"$log\"\n+\t\telse\n+\t\t\techo \"$ref\"\n+\t\tfi\n+\tdone\n+}\n+\n+ls_local_branches() {\n+\tgit-rev-parse --symbolic --branches |\n+\tsort |\n+\twhile read ref\n+\tdo\n+\t\tif test \"$headref\" = \"$ref\"\n+\t\tthen\n+\t\t\tpfx='*'\n+\t\telse\n+\t\t\tpfx=' '\n+\t\tfi\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+}\n+\n while case \"$#,$1\" in 0,*) break ;; *,-*) ;; *) break ;; esac\n do\n \tcase \"$1\" in\n@@ -65,8 +98,7 @@ do\n \t\texit\n \t\t;;\n \t-r)\n-\t\tls_remote_branches\n-\t\texit\n+\t\tremotes=\"yes\"\n \t\t;;\n \t-f)\n \t\tforce=\"$1\"\n@@ -90,24 +122,12 @@ done\n \n case \"$#\" in\n 0)\n-\tgit-rev-parse --symbolic --branches |\n-\tsort |\n-\twhile read ref\n-\tdo\n-\t\tif test \"$headref\" = \"$ref\"\n-\t\tthen\n-\t\t\tpfx='*'\n-\t\telse\n-\t\t\tpfx=' '\n-\t\tfi\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+\tif test \"$remotes\" = \"yes\"\n+\tthen\n+\t\tls_remote_branches\n+\telse\n+\t\tls_local_branches\n+\tfi\n \texit 0 ;;\n 1)\n \thead=HEAD ;;\n-- \n1.4.3.1\n"},{"id":"29564","messageId":"11614700063082-git-send-email-hjemli@gmail.com","threadId":"5990","inReplyTo":"1161470004894-git-send-email-hjemli@gmail.com","subject":"[PATCH 2/3] git-branch: Add -w option to adjust branchname column width","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-10-21T22:33:23Z","receivedAt":"2006-10-21T22:33:23Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n git-branch.sh |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/git-branch.sh b/git-branch.sh\nindex 25abd4c..0d9eb06 100755\n--- a/git-branch.sh\n+++ b/git-branch.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n \n-USAGE='[-r] [-v] | (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>]'\n+USAGE='[-r] [-v [-w <width>]] | (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>]'\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@@ -52,6 +52,7 @@ force=\n create_log=\n verbose=\n remotes=\n+width=20\n \n ls_remote_branches () {\n \tgit-rev-parse --symbolic --all |\n@@ -62,7 +63,7 @@ ls_remote_branches () {\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 \"%-20s %s\\n\" \"$ref\" \"$log\"\n+\t\t\tprintf \"%-*s %s\\n\" \"$width\" \"$ref\" \"$log\"\n \t\telse\n \t\t\techo \"$ref\"\n \t\tfi\n@@ -83,7 +84,7 @@ ls_local_branches() {\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\t\tprintf \"%s %-*s %s\\n\" \"$pfx\" \"$width\" \"$ref\" \"$log\"\n \t\telse\n \t\t\techo \"$pfx $ref\"\n \t\tfi\n@@ -108,6 +109,10 @@ do\n \t\t;;\n \t-v)\n \t\tverbose=\"yes\"\n+\t\t;;\n+\t-w)\n+\t\tshift\n+\t\twidth=\"$1\"\n \t\t;;\n \t--)\n \t\tshift\n-- \n1.4.3.1\n"},{"id":"29566","messageId":"1161470006965-git-send-email-hjemli@gmail.com","threadId":"5990","inReplyTo":"1161470004894-git-send-email-hjemli@gmail.com","subject":"[PATCH 3/3] Update documentation for git-branch","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-10-21T22:33:24Z","receivedAt":"2006-10-21T22:33:24Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n Documentation/git-branch.txt |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex d43ef1d..dc6676e 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -8,7 +8,7 @@ git-branch - List, create, or delete bra\n SYNOPSIS\n --------\n [verse]\n-'git-branch' [-r]\n+'git-branch' [-r] [-v [-w <width>]]\n 'git-branch' [-l] [-f] <branchname> [<start-point>]\n 'git-branch' (-d | -D) <branchname>...\n \n@@ -47,6 +47,12 @@ OPTIONS\n -r::\n \tList only the \"remote\" branches.\n \n+-v::\n+\tShow sha1 and first line of commit message for each branch\n+\n+-w <width>::\n+\tSet columnwidth for branchname (default is 20)\n+\n <branchname>::\n \tThe name of the branch to create or delete.\n \tThe new branch name must pass all checks defined by\n-- \n1.4.3.1\n"}]}