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

Re: [PATCH 0/6] clean up parsing of maybe_bool

From
Stefan Beller <sbeller@google.com>
Date
Aug 7, 2017, 18:44 UTC
Message-ID
<CAGZ79kaEA7DRm4inO=XPCVvA3mJioV_yckAVEUbCo5DEwoxbUQ@mail.gmail.com>
In-Reply-To
<cover.1502128418.git.martin.agren@gmail.com>
On Mon, Aug 7, 2017 at 11:20 AM, Martin Ågren <martin.agren@gmail.com> wrote:
Show 23 quoted lines
> When we want to parse a boolean config item without dying on error, we
> call git_config_maybe_bool() which takes two arguments: the value to be
> parsed (obviously) and a `name` which is completely ignored. Junio has
> suggested to drop `name` and rename the function [1]. That effort even
> started shortly after that, by introducing git_parse_maybe_bool(). The
> new function currently only has a single user outside config.c.
>
> Patch 5 of this series deprecates the old function and updates all
> callers to use git_parse_maybe_bool() instead. Patch 6 is a final
> cleanup: one of the converted callers suddenly had an unused argument.
>
> Patches 3 and 4 prepare for the switch. In particular, patch 4 ensures
> that the two functions are actually equivalent. In doing so, it affects
> `git push --signed=..` which was very slightly inconsistent to the rest
> of Git.
>
> Patch 2 adds a failing test in preparation for patch 4. Patch 1 corrects
> the documentation not to say "git push --sign=.." to make it a bit more
> obvious that the opposite typo is not being made in patches 2 and 4.
>
> git_parse_maybe_bool is used in sb/diff-color-move, which is in "next".
> This series makes --color-moved and diff.colormoved consistent with
> other booleans. That should be a good thing, but cc Stefan to be sure.

The series looks fine to me overall, though patch 5 is overly gentle IMHO. We could have removed it right there as Junio is very good at resolving conflicts or producing dirty merges for such a situation. But delaying it until no other series' are in flight is fine with me, too.

Looking back at sb/diff-color-move and the code where git_parse_maybe_bool is used, I do not think this will be an issue.

Thanks, Stefan

Previous: Martin ÅgrenNext: Junio C Hamano
Message 9 of 13 in “clean up parsing of maybe_bool”
  1. 0/6 clean up parsing of maybe_boolMartin Ågren, Aug 7, 2017
  2. 1/6 Doc/git-{push,send-pack}: correct --sign= to --signed=Martin Ågren, Aug 7, 2017
  3. 2/6 t5334: document that git push --signed=1 does not workMartin Ågren, Aug 7, 2017
  4. Junio C HamanoAug 7, 2017
  5. 3/6 config: introduce git_parse_maybe_bool_textMartin Ågren, Aug 7, 2017
  6. 4/6 config: make git_{config,parse}_maybe_bool equivalentMartin Ågren, Aug 7, 2017
  7. 5/6 treewide: deprecate git_config_maybe_bool, use git_parse_maybe_boolMartin Ågren, Aug 7, 2017
  8. 6/6 parse_decoration_style: drop unused argument `var`Martin Ågren, Aug 7, 2017
  9. Stefan BellerAug 7, 2017
  10. Junio C HamanoAug 7, 2017
  11. Martin ÅgrenAug 8, 2017
  12. Junio C HamanoAug 8, 2017
  13. Martin ÅgrenAug 8, 2017

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.