# [PATCH] git-completion.bash: Silence not a valid object errors

4 messages from 2013-01-11 to 2013-01-11. Participants: Dylan Smith, Jeff King, Junio C Hamano, Manlio Perillo.
Thread: https://gitlist.dev/t/32591

## Dylan Smith, 2013-01-11 08:06

Subject: [PATCH] git-completion.bash: Silence not a valid object errors
Message-ID: <alpine.DEB.2.02.1301110304220.26739@antec>
URL: https://gitlist.dev/e/alpine.DEB.2.02.1301110304220.26739%40antec

```
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>
---
 contrib/completion/git-completion.bash |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0b77eb1..d4c7bfe 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -397,7 +397,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,$, ,
-- 
1.7.9.5

```

## Jeff King, 2013-01-11 15:27

Subject: Re: [PATCH] git-completion.bash: Silence not a valid object errors
Message-ID: <20130111152702.GA5219@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130111152702.GA5219%40sigill.intra.peff.net
In-Reply-To: <alpine.DEB.2.02.1301110304220.26739@antec>

```
On Fri, Jan 11, 2013 at 03:06:22AM -0500, Dylan Smith wrote:

> 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>
> ---

Thanks, I've been annoyed by this, too. The fix looks obviously correct.

-Peff

```

## Junio C Hamano, 2013-01-11 16:45

Subject: Re: [PATCH] git-completion.bash: Silence not a valid object errors
Message-ID: <7v6233d5ya.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v6233d5ya.fsf%40alter.siamese.dyndns.org
In-Reply-To: <alpine.DEB.2.02.1301110304220.26739@antec>

```
Dylan Smith <dylan.ah.smith@gmail.com> writes:

> 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>
> ---

Looks obviously correct.  Thanks.

>  contrib/completion/git-completion.bash |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 0b77eb1..d4c7bfe 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -397,7 +397,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,$, ,

```

## Manlio Perillo, 2013-01-11 21:12

Subject: Re: [PATCH] git-completion.bash: Silence not a valid object errors
Message-ID: <50F08020.2010701@gmail.com>
URL: https://gitlist.dev/e/50F08020.2010701%40gmail.com
In-Reply-To: <alpine.DEB.2.02.1301110304220.26739@antec>

```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 11/01/2013 09:06, Dylan Smith ha scritto:
> 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.
> 

I reported the problem a few weeks ago; thanks.

> [...]


Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDwgCAACgkQscQJ24LbaUTAxgCfZbB8X8IaTZAcT8iTs1XIILBJ
72MAn2zlh3xbRa/wjq1WyA2yOiAlaCr7
=dMN7
-----END PGP SIGNATURE-----

```
