git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Extend git-branch list output
@ 2006-10-21 22:33 Lars Hjemli
  2006-10-21 22:33 ` [PATCH 1/3] Make git-branch honor -v when showing remote branches Lars Hjemli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lars Hjemli @ 2006-10-21 22:33 UTC (permalink / raw)
  To: git

This patch-series is on top of my previous patch to git-branch.sh

Shortlog:
 [PATCH 1/3] Make git-branch honor -v when showing remote branches
 [PATCH 2/3] git-branch: Add -w option to adjust branchname column width
 [PATCH 3/3] Update documentation for git-branch

Diffstat:
 Documentation/git-branch.txt |    8 ++++-
 git-branch.sh                |   79 +++++++++++++++++++++++++++--------------
 2 files changed, 59 insertions(+), 28 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] Make git-branch honor -v when showing remote branches
  2006-10-21 22:33 [PATCH 0/3] Extend git-branch list output Lars Hjemli
@ 2006-10-21 22:33 ` Lars Hjemli
  2006-10-21 22:33 ` [PATCH 2/3] git-branch: Add -w option to adjust branchname column width Lars Hjemli
  2006-10-21 22:33 ` [PATCH 3/3] Update documentation for git-branch Lars Hjemli
  2 siblings, 0 replies; 4+ messages in thread
From: Lars Hjemli @ 2006-10-21 22:33 UTC (permalink / raw)
  To: git

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 git-branch.sh |   74 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/git-branch.sh b/git-branch.sh
index ab58737..25abd4c 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 | -v'
+USAGE='[-r] [-v] | (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>]'
 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>.'
@@ -48,15 +48,48 @@ If you are sure you want to delete it, r
     exit 0
 }
 
-ls_remote_branches () {
-    git-rev-parse --symbolic --all |
-    sed -ne 's|^refs/\(remotes/\)|\1|p' |
-    sort
-}
-
 force=
 create_log=
 verbose=
+remotes=
+
+ls_remote_branches () {
+	git-rev-parse --symbolic --all |
+	sed -ne 's|^refs/\(remotes/\)|\1|p' |
+	sort |
+	while read ref
+	do
+		if test "$verbose" = "yes"
+		then
+			log=$(git-log --max-count=1 --pretty=oneline $ref)
+			printf "%-20s %s\n" "$ref" "$log"
+		else
+			echo "$ref"
+		fi
+	done
+}
+
+ls_local_branches() {
+	git-rev-parse --symbolic --branches |
+	sort |
+	while read ref
+	do
+		if test "$headref" = "$ref"
+		then
+			pfx='*'
+		else
+			pfx=' '
+		fi
+		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
+}
+
 while case "$#,$1" in 0,*) break ;; *,-*) ;; *) break ;; esac
 do
 	case "$1" in
@@ -65,8 +98,7 @@ do
 		exit
 		;;
 	-r)
-		ls_remote_branches
-		exit
+		remotes="yes"
 		;;
 	-f)
 		force="$1"
@@ -90,24 +122,12 @@ done
 
 case "$#" in
 0)
-	git-rev-parse --symbolic --branches |
-	sort |
-	while read ref
-	do
-		if test "$headref" = "$ref"
-		then
-			pfx='*'
-		else
-			pfx=' '
-		fi
-		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
+	if test "$remotes" = "yes"
+	then
+		ls_remote_branches
+	else
+		ls_local_branches
+	fi
 	exit 0 ;;
 1)
 	head=HEAD ;;
-- 
1.4.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] git-branch: Add -w option to adjust branchname column width
  2006-10-21 22:33 [PATCH 0/3] Extend git-branch list output Lars Hjemli
  2006-10-21 22:33 ` [PATCH 1/3] Make git-branch honor -v when showing remote branches Lars Hjemli
@ 2006-10-21 22:33 ` Lars Hjemli
  2006-10-21 22:33 ` [PATCH 3/3] Update documentation for git-branch Lars Hjemli
  2 siblings, 0 replies; 4+ messages in thread
From: Lars Hjemli @ 2006-10-21 22:33 UTC (permalink / raw)
  To: git

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 git-branch.sh |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/git-branch.sh b/git-branch.sh
index 25abd4c..0d9eb06 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-USAGE='[-r] [-v] | (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>]'
+USAGE='[-r] [-v [-w <width>]] | (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>]'
 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>.'
@@ -52,6 +52,7 @@ force=
 create_log=
 verbose=
 remotes=
+width=20
 
 ls_remote_branches () {
 	git-rev-parse --symbolic --all |
@@ -62,7 +63,7 @@ ls_remote_branches () {
 		if test "$verbose" = "yes"
 		then
 			log=$(git-log --max-count=1 --pretty=oneline $ref)
-			printf "%-20s %s\n" "$ref" "$log"
+			printf "%-*s %s\n" "$width" "$ref" "$log"
 		else
 			echo "$ref"
 		fi
@@ -83,7 +84,7 @@ ls_local_branches() {
 		if test "$verbose" = "yes"
 		then
 			log=$(git-log --max-count=1 --pretty=oneline $ref)
-			printf "%s %-20s %s\n" "$pfx" "$ref" "$log"
+			printf "%s %-*s %s\n" "$pfx" "$width" "$ref" "$log"
 		else
 			echo "$pfx $ref"
 		fi
@@ -108,6 +109,10 @@ do
 		;;
 	-v)
 		verbose="yes"
+		;;
+	-w)
+		shift
+		width="$1"
 		;;
 	--)
 		shift
-- 
1.4.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] Update documentation for git-branch
  2006-10-21 22:33 [PATCH 0/3] Extend git-branch list output Lars Hjemli
  2006-10-21 22:33 ` [PATCH 1/3] Make git-branch honor -v when showing remote branches Lars Hjemli
  2006-10-21 22:33 ` [PATCH 2/3] git-branch: Add -w option to adjust branchname column width Lars Hjemli
@ 2006-10-21 22:33 ` Lars Hjemli
  2 siblings, 0 replies; 4+ messages in thread
From: Lars Hjemli @ 2006-10-21 22:33 UTC (permalink / raw)
  To: git

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 Documentation/git-branch.txt |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index d43ef1d..dc6676e 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -8,7 +8,7 @@ git-branch - List, create, or delete bra
 SYNOPSIS
 --------
 [verse]
-'git-branch' [-r]
+'git-branch' [-r] [-v [-w <width>]]
 'git-branch' [-l] [-f] <branchname> [<start-point>]
 'git-branch' (-d | -D) <branchname>...
 
@@ -47,6 +47,12 @@ OPTIONS
 -r::
 	List only the "remote" branches.
 
+-v::
+	Show sha1 and first line of commit message for each branch
+
+-w <width>::
+	Set columnwidth for branchname (default is 20)
+
 <branchname>::
 	The name of the branch to create or delete.
 	The new branch name must pass all checks defined by
-- 
1.4.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-10-21 22:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-21 22:33 [PATCH 0/3] Extend git-branch list output Lars Hjemli
2006-10-21 22:33 ` [PATCH 1/3] Make git-branch honor -v when showing remote branches Lars Hjemli
2006-10-21 22:33 ` [PATCH 2/3] git-branch: Add -w option to adjust branchname column width Lars Hjemli
2006-10-21 22:33 ` [PATCH 3/3] Update documentation for git-branch Lars Hjemli

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).