completion: support excluding full refs

Commit 49416ad22 (completion: support excluding refs, 2016-08-24) made
possible to complete short refs with a '^' prefix.

Extend the support to full refs to make completing '^refs/...' work.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
SZEDER Gábor
2017-03-23 16:29:15 +01:00
committed by Junio C Hamano
parent aa0644f74f
commit aed3881359
2 changed files with 35 additions and 4 deletions

View File

@ -387,6 +387,10 @@ __git_refs ()
fi
if [ "$list_refs_from" = path ]; then
if [[ "$cur_" == ^* ]]; then
pfx="^"
cur_=${cur_#^}
fi
case "$cur_" in
refs|refs/*)
format="refname"
@ -394,10 +398,6 @@ __git_refs ()
track=""
;;
*)
if [[ "$cur_" == ^* ]]; then
pfx="^"
cur_=${cur_#^}
fi
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
if [ -e "$dir/$i" ]; then echo $pfx$i; fi
done