Re: [PATCH 01/15] Move split_cmdline() to alias.c
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 29, 2008, 14:43 UTC
- Message-ID
- <alpine.DEB.1.00.0806291542070.9925@racer>
- In-Reply-To
- <48679C44.30702@free.fr>
Hi,
On Sun, 29 Jun 2008, Olivier Marin wrote:
Show 10 quoted lines
> Johannes Schindelin a écrit : > > > > As the string comes either from the config (where it is trimmed), or > > from the command line (where the user can be stup^W^Wask for > > whitespace explicitely), I do not see much merit in this patch. > > You are right, today it is not a problem because the usage is really > limited but Miklos's intention seems to make the function usable by > everyone. As we do not know how it will be used in the future, I think > it is safer with my patch.
I am generally not a fan of crossing bridges miles before you reach them.
But if you want to keep running with this, you should add at least a few tests to show what you patch solves, and that it solves it. Preferably with a "test_expect_failure" patch, and then a patch fixing it and changing that _failure to _success.
Here's a starter:
-- snipsnap --
diff --git a/Makefile b/Makefile index d3e339a..83a9a30 100644 --- a/Makefile +++ b/Makefile @@ -1229,7 +1229,7 @@ endif ### Testing rules -TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X test-parse-options$X test-strbuf$X +TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X test-parse-options$X test-strbuf$X test-cmdline$X all:: $(TEST_PROGRAMS) diff --git a/test-cmdline.c b/test-cmdline.c new file mode 100644 index 0000000..2f6d9eb --- /dev/null +++ b/test-cmdline.c @@ -0,0 +1,15 @@ +#include "cache.h" + +int main(int argc, char **argv) +{ + int i = 0; + const char **new_argv; + + if (argc < 2 || (argc = split_cmdline(argv[1], &new_argv)) < 0) + return 1; + + while (i < argc) + printf("arg %d: '%s'\n", i++, *new_argv++); + + return 0; +}