completion: don't list 'HEAD' when trying refs completion outside of a repo
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 3 Feb 2017 02:48:19 +0000 (03:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 4 Feb 2017 06:18:40 +0000 (22:18 -0800)
commit62a1b732160c363a84be310f801b5dec59196b9c
tree4fca423596204c5cff6a46b36a1b528056497bc3
parent69a775963b76824511fe4bdaf949f2e44df4b7a5
completion: don't list 'HEAD' when trying refs completion outside of a repo

When refs completion is attempted while not in a git repository, the
completion script offers 'HEAD' erroneously.

Check early in __git_refs() that there is either a repository or a
remote to work on, and return early if neither is given.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
t/t9902-completion.sh