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

Re: [RFC/PATCH 07/18] revert: put option information in an option struct

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 26, 2010, 18:42 UTC
Message-ID
<7vzksworiq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101125212050.5188.8316.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> This is needed because we want to reuse the parse_args() function
> so that we can parse options saved in a TODO file.

This probably is not _needed_ but something you thought would be a good thing to do while at it.

You forgot to mention something more important, though. You added two extra arguments to revert_or_cherry_pick, neither of which I agree with.

 * it is a regression to call the first extra argument "int revert";
   (action == REVERT) was more readable.
 * "int edit" is ill thought out; it is about giving the default of "edit"
   to revert_or_cherry_pick() depending on what action it is going to
   take.  In this particular case, the logic for the default of "edit" is
   trivial and localized (it is 0 unless we are interactive revert), so I
   would drop the argument and have default logic immediately after
   "memset(&info, 0, sizeof(info))".
   If there were many such args-info elements whose default have to be
   different depending on the action, the caller should be passing an
   instance of "struct args_info" with the default, and have the parser
   to update the default supplied.  I don't think it is warranted in this
   case.

By the way, "infos" is an eyesore at least to me. Any data you work on is information, naming a variable "struct args_info info", unless it primarily works on that "args_info" and not any other kinds of info (like "struct rev_info revs"), is like calling a variable "var", adding _no_ useful information.

Previous: Jonathan NiederNext: Christian Couder
Message 14 of 27 in “WIP implement cherry-pick/revert --continue”
  1. 00/18 WIP implement cherry-pick/revert --continueChristian Couder, Nov 25, 2010
  2. 01/18 advice: add error_resolve_conflict() functionChristian Couder, Nov 25, 2010
  3. Jonathan NiederNov 26, 2010
  4. 02/18 revert: change many die() calls into "return error()" callsChristian Couder, Nov 25, 2010
  5. Jonathan NiederNov 26, 2010
  6. 03/18 usage: implement error_errno() the same way as die_errno()Christian Couder, Nov 25, 2010
  7. Jonathan NiederNov 26, 2010
  8. Junio C HamanoNov 26, 2010
  9. 04/18 revert: don't die when write_message() failsChristian Couder, Nov 25, 2010
  10. 05/18 commit: move reverse_commit_list() into commit.{h, c}Christian Couder, Nov 25, 2010
  11. 06/18 revert: remove "commit" global variableChristian Couder, Nov 25, 2010
  12. 07/18 revert: put option information in an option structChristian Couder, Nov 25, 2010
  13. Jonathan NiederNov 26, 2010
  14. Junio C HamanoNov 26, 2010
  15. 08/18 revert: refactor code into a new pick_commits() functionChristian Couder, Nov 25, 2010
  16. Daniel BarkalowNov 27, 2010
  17. 09/18 revert: make pick_commits() return an error on --ff incompatible optionChristian Couder, Nov 25, 2010
  18. 10/18 revert: make read_and_refresh_cache() and prepare_revs() return errorsChristian Couder, Nov 25, 2010
  19. 11/18 revert: add get_todo_content() and create_todo_file()Christian Couder, Nov 25, 2010
  20. 12/18 revert: write TODO and DONE files in case of failureChristian Couder, Nov 25, 2010
  21. 13/18 revert: add option parsing for option --continueChristian Couder, Nov 25, 2010
  22. 14/18 revert: move global variable "me" into "struct args_info"Christian Couder, Nov 25, 2010
  23. 15/18 revert: add NONE action and make parse_args() manage itChristian Couder, Nov 25, 2010
  24. 16/18 revert: implement parsing TODO and DONE filesChristian Couder, Nov 25, 2010
  25. 17/18 revert: add remaining instructions in todo fileChristian Couder, Nov 25, 2010
  26. 18/18 revert: implement --continue processingChristian Couder, Nov 25, 2010
  27. Jonathan NiederNov 26, 2010

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.