Skip to contentSkip to conversation

git-completion.bash: Silence not a valid object errors

PATCH In review Dylan Smith 4 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-completion.bash: Silence not a valid object errors

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.

---
 contrib/completion/git-completion.bash |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
index 0b77eb1..d4c7bfe 100644
@@ -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,$, ,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 9 lines · Dylan Smith

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.

---

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

-Peff

#2 lore raw
In reply to Dylan Smith

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

Il 11/01/2013 09:06, Dylan Smith ha scritto:

Quoted 7 lines

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.

Quoted 1 line

[...]

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

#3 lore raw
In reply to Dylan Smith
Quoted 9 lines · Dylan Smith

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.

---

Looks obviously correct. Thanks.

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