diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-01-26 08:54:46 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-26 08:54:46 -0800 |
commit | c7c0811fd09d491cf642906f18f10eceb2066588 (patch) | |
tree | 35c34e4f6a6621fe2f30e5063f7e2f2909a6b43a /contrib/completion | |
parent | bb98703f6009326eda0f9bded24fbb7a84f69c3b (diff) | |
parent | 020e0a087f2101182343936b8d58f0b4c96e96df (diff) | |
download | git-c7c0811fd09d491cf642906f18f10eceb2066588.tar.gz |
Merge branch 'ps/completion-with-reftable-fix'
Completion update to prepare for reftable
* ps/completion-with-reftable-fix:
completion: treat dangling symrefs as existing pseudorefs
completion: silence pseudoref existence check
completion: improve existence check for pseudo-refs
t9902: verify that completion does not print anything
completion: discover repo path in `__git_pseudoref_exists ()`
Diffstat (limited to 'contrib/completion')
-rw-r--r-- | contrib/completion/git-completion.bash | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8c40ade494..6662db221d 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -137,6 +137,9 @@ __git_eread () __git_pseudoref_exists () { local ref=$1 + local head + + __git_find_repo_path # If the reftable is in use, we have to shell out to 'git rev-parse' # to determine whether the ref exists instead of looking directly in @@ -144,9 +147,8 @@ __git_pseudoref_exists () # Bash builtins since executing Git commands are expensive on some # platforms. if __git_eread "$__git_repo_path/HEAD" head; then - b="${head#ref: }" - if [ "$b" == "refs/heads/.invalid" ]; then - __git -C "$__git_repo_path" rev-parse --verify --quiet "$ref" 2>/dev/null + if [ "$head" == "ref: refs/heads/.invalid" ]; then + __git show-ref --exists "$ref" return $? fi fi @@ -1656,7 +1658,6 @@ __git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options _git_cherry_pick () { - __git_find_repo_path if __git_pseudoref_exists CHERRY_PICK_HEAD; then __gitcomp "$__git_cherry_pick_inprogress_options" return @@ -2966,7 +2967,6 @@ _git_reset () _git_restore () { - __git_find_repo_path case "$prev" in -s) __git_complete_refs @@ -2995,7 +2995,6 @@ __git_revert_inprogress_options=$__git_sequencer_inprogress_options _git_revert () { - __git_find_repo_path if __git_pseudoref_exists REVERT_HEAD; then __gitcomp "$__git_revert_inprogress_options" return |