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

completion troubles with bash

From
PBPascal Bourdier <pascal.bourdier@gmail.com>
Date
May 1, 2018, 12:17 UTC
Message-ID
<CAPQz56bts8zFfUHyKJqnefQoH97L5TTA-k3be=5HsdeEbcMqOA@mail.gmail.com>
Hi,

If "GREP_OPTIONS" is set to '--color=always' , then the git completion send some escape characters like this :

^[[1;35;40m^[[K d^[[m^[[Kiff-files mergetool a^[[m^[[Kdd d^[[m^[[Kiff-index mv a^[[m^[[Kddremove d^[[m^[[Kiff-tree name-rev a^[[m^[[Km d^[[m^[[Kifftool notes ...

So you could find a small patch to disable color with "grep" in attachment.
Regards,
Pascal Bourdier
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b09c8a236..0bc55b9ee 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -837,7 +837,7 @@ __git_commands () {
 	then
 		printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
 	else
-		git help -a|egrep '^  [a-zA-Z0-9]'
+		git help -a|egrep --color=never '^  [a-zA-Z0-9]'
 	fi
 }
 
Next: Duy Nguyen
Message 1 of 2 in “completion troubles with bash”
  1. Pascal BourdierMay 1, 2018
  2. Duy NguyenMay 1, 2018

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.