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

Re: [PATCH 03/11] revert: Introduce a struct to parse command-line options into

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 10, 2011, 19:21 UTC
Message-ID
<20110410192154.GB28163@elie>
In-Reply-To
<1302448317-32387-4-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra wrote:
> [Subject: revert: Introduce a struct to parse command-line options into]
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>

This gives a hint of another way to avoid the usage() trouble mentioned in patch 1: it might be possible to let the caller take care of parsing arguments.

Show 14 quoted lines
> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -35,17 +35,27 @@ static const char * const cherry_pick_usage[] = {
>  	NULL
>  };
>  
> -static int edit, no_replay, no_commit, mainline, signoff, allow_ff;
> -static enum { REVERT, CHERRY_PICK } action;
> -static int commit_argc;
> -static const char **commit_argv;
> -static int allow_rerere_auto;
>  
> +static struct {
> +	enum { REVERT, CHERRY_PICK } action;

That would require giving this struct a name, so it can be passed around. Not a bad idea anyway imho since then a person reading top-to-bottom is not left in suspense:

 struct cherry_pick_opts {
	enum { REVERT, CHERRY_PICK } action;
	unsigned edit:1;
	unsigned no_replay:1;
	...
 };
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 10 of 36 in “Sequencer Foundations”
  1. 00/11 Sequencer FoundationsRamkumar Ramachandra, Apr 10, 2011
  2. 01/11 revert: Avoid calling die; return error insteadRamkumar Ramachandra, Apr 10, 2011
  3. Jonathan NiederApr 10, 2011
  4. Ramkumar RamachandraMay 8, 2011
  5. Junio C HamanoApr 11, 2011
  6. 02/11 revert: Lose global variables "commit" and "me"Ramkumar Ramachandra, Apr 10, 2011
  7. Christian CouderApr 11, 2011
  8. Ramkumar RamachandraApr 11, 2011
  9. 03/11 revert: Introduce a struct to parse command-line options intoRamkumar Ramachandra, Apr 10, 2011
  10. Jonathan NiederApr 10, 2011
  11. Ramkumar RamachandraMay 8, 2011
  12. Junio C HamanoApr 11, 2011
  13. Ramkumar RamachandraMay 8, 2011
  14. 04/11 revert: Separate cmdline argument handling from the functional codeRamkumar Ramachandra, Apr 10, 2011
  15. 05/11 revert: Catch incompatible command-line options earlyRamkumar Ramachandra, Apr 10, 2011
  16. Junio C HamanoApr 11, 2011
  17. Ramkumar RamachandraMay 8, 2011
  18. 06/11 revert: Implement parsing --continue, --abort and --skipRamkumar Ramachandra, Apr 10, 2011
  19. 07/11 revert: Handle conflict resolutions more elegantlyRamkumar Ramachandra, Apr 10, 2011
  20. 08/11 usage: Introduce error_errno correspoding to die_errnoRamkumar Ramachandra, Apr 10, 2011
  21. 09/11 revert: Write head, todo, done filesRamkumar Ramachandra, Apr 10, 2011
  22. 10/11 revert: Give noop a default value while argument parsingRamkumar Ramachandra, Apr 10, 2011
  23. 11/11 revert: Implement --abort processingRamkumar Ramachandra, Apr 10, 2011
  24. Daniel BarkalowApr 10, 2011
  25. Ramkumar RamachandraApr 11, 2011
  26. Jonathan NiederApr 10, 2011
  27. Daniel BarkalowApr 11, 2011
  28. Jonathan NiederApr 11, 2011
  29. Ramkumar RamachandraApr 11, 2011
  30. Christian CouderApr 11, 2011
  31. Ramkumar RamachandraApr 11, 2011
  32. Christian CouderApr 11, 2011
  33. Ramkumar RamachandraApr 11, 2011
  34. Daniel BarkalowApr 11, 2011
  35. Jonathan NiederApr 11, 2011
  36. Daniel BarkalowApr 11, 2011

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.