Merge branch 'js/completion-hide-not-a-repo'
authorJunio C Hamano <gitster@pobox.com>
Tue, 21 Oct 2014 20:28:50 +0000 (13:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Oct 2014 20:28:50 +0000 (13:28 -0700)
Some internal error messages leaked out of the bash completion when
typing "git cmd <TAB>" and the machinery tried to complete
refnames.

* js/completion-hide-not-a-repo:
completion: silence "fatal: Not a git repository" error

contrib/completion/git-completion.bash
index d548e99ebc213cc107b61acbdafa065bbb46dc30..8704451e52e9ed4239ec7a8e96d3fd8e6be4cb01 100644 (file)
@@ -384,7 +384,8 @@ __git_refs ()
                ;;
        *)
                echo "HEAD"
-               git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##"
+               git for-each-ref --format="%(refname:short)" -- \
+                       "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##"
                ;;
        esac
 }