From f430bd75c680c7a8cc09b7c501e50726b1ddbbff Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 24 Jan 2012 00:50:51 -0500 Subject: [PATCH] Filter the HEAD symbolic reference. --- plugins/git/completions/_git-hub | 7 ++++--- plugins/git/functions/git-hub | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub index da1f355..e4e2945 100644 --- a/plugins/git/completions/_git-hub +++ b/plugins/git/completions/_git-hub @@ -18,9 +18,10 @@ case "$state" in (branch) remote="$words[(($CURRENT - 1))]" branches=($( - git branch -a \ - | grep "remotes/${remote}" \ - | sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g" + git branch -r \ + | sed \ + -e "/${remote}\/HEAD -> ${remote}/d" \ + -e "s/^[[:space:]]*${remote}\///g" )) _describe -t branch 'branches' branches && ret=0 ;; diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index 2ef84ee..7deeddf 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -8,9 +8,7 @@ url=$( | sed -En "s/remote.${remote}.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) branches=($( - git branch -a \ - | grep "remotes/${remote}" \ - | sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g" + git branch -r | sed -e "/${remote}\/HEAD -> ${remote}/d" -e "s/^[[:space:]]*${remote}\///g" )) current_branch="$(git-branch)" branch="${2:-master}"