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

Re: [RFC] Instruct git-completion.bash that we are in test mode

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 22, 2013, 16:31 UTC
Message-ID
<7vham9b2n3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<50FE47F4.20104@gmail.com>
Jean-Noël Avila <avila.jn@gmail.com> writes:
Show 17 quoted lines
> Le 22/01/2013 05:31, Junio C Hamano a écrit :
>> Jeff King <peff@peff.net>  writes:
>>
>>> I really hate to suggest this, but should it be more like:
>>>
>>> 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
>>>
>>> That gives us a nice predictable starting point for actually
>>> testing the completion code. The downside is that it doesn't let
>>> us test that we remain compatible with the output of "help -a".
> ...
> Instead of imposing the list of command, we could use the command
> list argument to filter the ouput of git help -a. This would ensure that the
> completions we want to test are still present in the installation while
> still restricting them to the test case.

In order to "filter the output", you still need to know how output from "git help -a" looks like, and adjust the code to filter when the shape of the output changes. The effort to do so is pretty similar to the amount of effort needed to maintain FAKE_COMMAND_LIST to look like the output from "git help -a". It is of dubious value compared to the simplicity of "printf" FAKE_COMMAND_LIST approach, I think.

Previous: Jean-Noël AvilaNext: Junio C Hamano
Message 6 of 15 in “[RFC] Instruct git-completion.bash that we are in test mode”
  1. Jean-Noël AVILAJan 21, 2013
  2. Junio C HamanoJan 21, 2013
  3. Jeff KingJan 22, 2013
  4. Junio C HamanoJan 22, 2013
  5. Jean-Noël AvilaJan 22, 2013
  6. Junio C HamanoJan 22, 2013
  7. t9902: protect test from stray build artifactsJunio C Hamano, Jan 24, 2013
  8. Jeff KingJan 25, 2013
  9. Jonathan NiederJan 25, 2013
  10. Junio C HamanoJan 25, 2013
  11. Jeff KingJan 25, 2013
  12. Junio C HamanoJan 25, 2013
  13. Jeff KingJan 25, 2013
  14. Junio C HamanoJan 25, 2013
  15. Jeff KingJan 25, 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.