git-completion.bash: silence "not a valid object" errors
authorDylan Smith <dylan.ah.smith@gmail.com>
Fri, 11 Jan 2013 08:06:22 +0000 (03:06 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Jan 2013 16:44:08 +0000 (08:44 -0800)
Trying to complete the command

  git show master:./file

would cause a "Not a valid object name" error to be output on standard
error. Silence the error so it won't appear on the command line.

Signed-off-by: Dylan Smith <dylan.ah.smith@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 2e1b5e14b92fe61e02df94ab165c8aab6c06c9cb..6312e3d8eb83e0f793ce11d40c75a35cb6fe1914 100755 (executable)
@@ -676,7 +676,7 @@ __git_complete_revlist_file ()
                *)   pfx="$ref:$pfx" ;;
                esac
 
-               __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
+               __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
                                | sed '/^100... blob /{
                                           s,^.*        ,,
                                           s,$, ,