aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-10 14:03:49 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-10 14:03:49 -0700
commita229a30f8a3f52343f52e8691f7261fe95cb4cf1 (patch)
treeb1a8d99991c885277bfeaf65c214a701e0044911 /contrib
parent667c6d591e2a92dd2e3d8cd503ead492c0f34334 (diff)
parent49416ad22aa917178f306859a5bab60311166a9f (diff)
downloadgit-a229a30f8a3f52343f52e8691f7261fe95cb4cf1.tar.gz
git-a229a30f8a3f52343f52e8691f7261fe95cb4cf1.tar.xz
Merge branch 'cp/completion-negative-refs'
The command-line completion script (in contrib/) learned to complete "git cmd ^mas<HT>" to complete the negative end of reference to "git cmd ^master". * cp/completion-negative-refs: completion: support excluding refs
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9c8f7380d..21016bf8d 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -338,7 +338,7 @@ __git_tags ()
__git_refs ()
{
local i hash dir="$(__gitdir "${1-}")" track="${2-}"
- local format refs
+ local format refs pfx
if [ -d "$dir" ]; then
case "$cur" in
refs|refs/*)
@@ -347,14 +347,15 @@ __git_refs ()
track=""
;;
*)
+ [[ "$cur" == ^* ]] && pfx="^"
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
- if [ -e "$dir/$i" ]; then echo $i; fi
+ if [ -e "$dir/$i" ]; then echo $pfx$i; fi
done
format="refname:short"
refs="refs/tags refs/heads refs/remotes"
;;
esac
- git --git-dir="$dir" for-each-ref --format="%($format)" \
+ git --git-dir="$dir" for-each-ref --format="$pfx%($format)" \
$refs
if [ -n "$track" ]; then
# employ the heuristic used by git checkout