git-branch: add -r switch to list refs/remotes/*
authorEric Wong <normalperson@yhbt.net>
Thu, 2 Mar 2006 20:23:17 +0000 (12:23 -0800)
committerJunio C Hamano <junkio@cox.net>
Fri, 3 Mar 2006 07:06:04 +0000 (23:06 -0800)
If we decide to use refs/remotes/, having a convenient way to
list them would be nice.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-branch.sh

index 6ac961e..663a3a3 100755 (executable)
@@ -48,6 +48,12 @@ If you are sure you want to delete it, run 'git branch -D $branch_name'."
     exit 0
 }
 
+ls_remote_branches () {
+    git-rev-parse --symbolic --all |
+    sed -ne 's|^refs/\(remotes/\)|\1|p' |
+    sort
+}
+
 force=
 while case "$#,$1" in 0,*) break ;; *,-*) ;; *) break ;; esac
 do
@@ -56,6 +62,10 @@ do
                delete_branch "$@"
                exit
                ;;
+       -r)
+               ls_remote_branches
+               exit
+               ;;
        -f)
                force="$1"
                ;;