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

[PATCH] completion: simplify __git_complete_revlist_file

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 1, 2012, 18:42 UTC
Message-ID
<1335897776-3726-1-git-send-email-felipe.contreras@gmail.com>

Use new __gitcomp_nl; this is the last place that uses COMPREPLY and compgen directly.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 31f714d..d877a23 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -676,9 +676,7 @@ __git_complete_revlist_file ()
 		*)   pfx="$ref:$pfx" ;;
 		esac
 
-		local IFS=$'\n'
-		COMPREPLY=($(compgen -P "$pfx" \
-			-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
+		__gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
 				| sed '/^100... blob /{
 				           s,^.*	,,
 				           s,$, ,
@@ -692,7 +690,7 @@ __git_complete_revlist_file ()
 				           s,$,/,
 				       }
 				       s/^.*	//')" \
-			-- "$cur_"))
+			"$pfx" "$cur_" ""
 		;;
 	*...*)
 		pfx="${cur_%...*}..."
-- 
1.7.10
Next: Junio C Hamano
Message 1 of 6 in “completion: simplify __git_complete_revlist_file”
  1. completion: simplify __git_complete_revlist_fileFelipe Contreras, May 1, 2012
  2. Junio C HamanoMay 1, 2012
  3. Felipe ContrerasMay 1, 2012
  4. Felipe ContrerasMay 5, 2012
  5. SZEDER GáborMay 5, 2012
  6. Junio C HamanoMay 7, 2012

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.