git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
DSDylan Smith <dylan.ah.smith@gmail.com>
Date
Jan 11, 2013, 08:06 UTC
Message-ID
<alpine.DEB.2.02.1301110304220.26739@antec>
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
Next: Jeff King
Message 1 of 4 in “git-completion.bash: Silence not a valid object errors”
  1. git-completion.bash: Silence not a valid object errorsDylan Smith, Jan 11, 2013
  2. Jeff KingJan 11, 2013
  3. Junio C HamanoJan 11, 2013
  4. Manlio PerilloJan 11, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.