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

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;
+}
Previous: Olivier MarinNext: Olivier Marin
Message 49 of 50 in “Build in merge”
  1. 00/15 Build in mergeMiklos Vajna, Jun 27, 2008
  2. 01/15 Move split_cmdline() to alias.cMiklos Vajna, Jun 27, 2008
  3. 02/15 Move commit_list_count() to commit.cMiklos Vajna, Jun 27, 2008
  4. 03/15 Move parse-options's skip_prefix() to git-compat-util.hMiklos Vajna, Jun 27, 2008
  5. 04/15 Add new test to ensure git-merge handles pull.twohead and pull.octopusMiklos Vajna, Jun 27, 2008
  6. 05/15 Move read_cache_unmerged() to read-cache.cMiklos Vajna, Jun 27, 2008
  7. 06/15 git-fmt-merge-msg: make it usable from other builtinsMiklos Vajna, Jun 27, 2008
  8. 07/15 Introduce get_octopus_merge_bases() in commit.cMiklos Vajna, Jun 27, 2008
  9. 08/15 Add new test to ensure git-merge handles more than 25 refs.Miklos Vajna, Jun 27, 2008
  10. 09/15 Introduce get_merge_bases_many()Miklos Vajna, Jun 27, 2008
  11. 10/15 Introduce reduce_heads()Miklos Vajna, Jun 27, 2008
  12. 11/15 Add strbuf_vaddf(), use it in strbuf_addf(), and add strbuf_initf()Miklos Vajna, Jun 27, 2008
  13. 12/15 strbuf_vaddf(): support %*s, tooMiklos Vajna, Jun 27, 2008
  14. 13/15 Add new test case to ensure git-merge reduces octopus parents when possibleMiklos Vajna, Jun 27, 2008
  15. 14/15 Add new test case to ensure git-merge prepends the custom merge messageMiklos Vajna, Jun 27, 2008
  16. 15/15 Build in mergeMiklos Vajna, Jun 27, 2008
  17. 15/15 Build in mergeMiklos Vajna, Jun 27, 2008
  18. Junio C HamanoJun 28, 2008
  19. Miklos VajnaJun 28, 2008
  20. 13/13 Build in mergeMiklos Vajna, Jun 28, 2008
  21. Junio C HamanoJun 29, 2008
  22. Jakub NarebskiJun 29, 2008
  23. Miklos VajnaJun 30, 2008
  24. 13/13 Build in mergeMiklos Vajna, Jun 30, 2008
  25. Junio C HamanoJun 30, 2008
  26. Alex RiesenJun 30, 2008
  27. Miklos VajnaJul 1, 2008
  28. Olivier MarinJun 30, 2008
  29. Miklos VajnaJun 30, 2008
  30. Junio C HamanoJun 30, 2008
  31. Miklos VajnaJun 30, 2008
  32. Johannes SchindelinJun 28, 2008
  33. Junio C HamanoJun 29, 2008
  34. Johannes SchindelinJun 29, 2008
  35. Alex RiesenJun 29, 2008
  36. Junio C HamanoJun 29, 2008
  37. Sverre RabbelierJun 29, 2008
  38. 08/15 Add new test to ensure git-merge handles more than 25 refs.Miklos Vajna, Jun 27, 2008
  39. Olivier MarinJun 29, 2008
  40. Add new test to ensure git-merge handles pull.twohead and pull.octopusMiklos Vajna, Jun 29, 2008
  41. Miklos VajnaJun 29, 2008
  42. Mike RalphsonJul 4, 2008
  43. Miklos VajnaJul 5, 2008
  44. Fix t7601-merge-pull-config.sh on AIXMiklos Vajna, Jul 5, 2008
  45. Junio C HamanoJul 5, 2008
  46. Olivier MarinJun 29, 2008
  47. Johannes SchindelinJun 29, 2008
  48. Olivier MarinJun 29, 2008
  49. Johannes SchindelinJun 29, 2008
  50. Olivier MarinJun 30, 2008

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.