Merge branch 'nd/completion-no-cache-failure'
authorJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)
An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.

* nd/completion-no-cache-failure:
completion: do not cache if --git-completion-helper fails

contrib/completion/git-completion.bash
index 9f71bcde967bc50915b90eaef72061f8c6a56315..8c6b610a2447cd1ec7c2dff0f9dbd09f6a024f57 100644 (file)
@@ -400,7 +400,8 @@ __gitcomp_builtin ()
        if [ -z "$options" ]; then
                # leading and trailing spaces are significant to make
                # option removal work correctly.
-               options=" $incl $(__git ${cmd/_/ } --git-completion-helper) "
+               options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return
+
                for i in $excl; do
                        options="${options/ $i / }"
                done