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

Re: [PATCH] t9902: Instruct git-completion.bash about a test mode

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 24, 2013, 22:29 UTC
Message-ID
<7vlibi8baq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201301242304.16078.jn.avila@free.fr>
"Jean-Noël AVILA" <jn.avila@free.fr> writes:
> My rational was to be sure to put the environment variable out of the 
> way once the script has been sourced. I can make two alternative 
> definitions of __git_list_all_commands () depending on the presence of 
> $AUTHORIZED_CMD_LIST if you are worried about performance.

Actually, it does not matter, as once __git_list_all_commands is run, its result is kept in a variable.

So Peff's
  if test -z "$FAKE_COMMAND_LIST"; then
          __git_cmdlist() {
                  git help -a | egrep '^  [a-zA-Z0-9]'
          }
  else
          __git_cmdlist() {
                  printf '%s' "$FAKE_COMMAND_LIST"
          }
  fi

would be just as simple if not simpler, does the same thing, and is sufficient, I think.

The t9902 test is only interested in making sure that the completion works, and we do not want "git help -a" that omits a subcommand from its output that is not built in your particular environment to get in the way, which will not be an issue with this approach.

Previous: Jean-Noël AVILANext: Jean-Noël AVILA
Message 4 of 5 in “t9902: Instruct git-completion.bash about a test mode”
  1. t9902: Instruct git-completion.bash about a test modeJean-Noël AVILA, Jan 24, 2013
  2. Junio C HamanoJan 24, 2013
  3. Jean-Noël AVILAJan 24, 2013
  4. Junio C HamanoJan 24, 2013
  5. Jean-Noël AVILAJan 24, 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.