Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:51

Jean-Noël Avila [off-list ref] writes:
Le 22/01/2013 05:31, Junio C Hamano a écrit :
quoted
Jeff King [off-list ref]  writes:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help