]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: squelch stray errors in sparse-checkout completion
authorElijah Newren <newren@gmail.com>
Sun, 3 Dec 2023 05:57:01 +0000 (05:57 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Dec 2023 06:25:14 +0000 (15:25 +0900)
If, in the root of a project, one types

    git sparse-checkout set --cone ../<TAB>

then an error message of the form

    fatal: ../: '../' is outside repository at '/home/newren/floss/git'

is written to stderr, which munges the users view of their own command.
Squelch such messages by using the __git() wrapper, designed for this
purpose; see commit e15098a314 (completion: consolidate silencing errors
from git commands, 2017-02-03) for more on the wrapper.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 13a39ebd2e73f9b34de743b797577a5e8e98cbae..b866170171813366ec74dbddaae1d4d9812428c1 100644 (file)
@@ -3084,7 +3084,7 @@ __gitcomp_directories ()
                        COMPREPLY+=("$c/")
                        _found=1
                fi
-       done < <(git ls-tree -z -d --name-only HEAD $_tmp_dir)
+       done < <(__git ls-tree -z -d --name-only HEAD $_tmp_dir)
 
        if [[ $_found == 0 ]] && [[ "$cur" =~ /$ ]]; then
                # No possible further completions any deeper, so assume we're at