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

[PATCH] completion: remove redundant __git_compute_all_commands() call

From
SZEDER Gábor <szeder@ira.uka.de>
Date
May 1, 2015, 15:48 UTC
Message-ID
<1430495336-8456-1-git-send-email-szeder@ira.uka.de>

During lazy-initialization of the lists of all commands and porcelain commands the function __git_compute_all_commands() is called twice. The relevant part of the call sequence looks like this:

  __git_compute_porcelain_commands()
     __git_compute_all_commands()
        <finds list of all commands uninitialized>
        __git_list_all_commands()
        <initializes list of all commands>
     __git_list_porcelain_commands()
        __git_compute_all_commands()
           <finds list of all commands already initialized, does nothing>
        <filters porcelains from list of all commands>

Either one of the two calls could be removed and the initialization of both command lists would still work as a whole, but let's remove the call from __git_compute_porcelain_commands(), because this way __git_list_porcelain_commands() will keep working in itself.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash | 1 -
 1 file changed, 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5944c82..8b0d2b4 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -735,7 +735,6 @@ __git_list_porcelain_commands ()
 __git_porcelain_commands=
 __git_compute_porcelain_commands ()
 {
-	__git_compute_all_commands
 	test -n "$__git_porcelain_commands" ||
 	__git_porcelain_commands=$(__git_list_porcelain_commands)
 }
-- 
1.9.5.msysgit.0
Message 1 of 1 in “completion: remove redundant __git_compute_all_commands() call”
  1. completion: remove redundant __git_compute_all_commands() callSZEDER Gábor, May 1, 2015

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.