<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/parse-options.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-06-02T19:51:35Z</updated>
<entry>
<title>parse-options.c: use optbug() instead of BUG() "opts" check</title>
<updated>2022-06-02T19:51:35Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-06-02T12:25:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5b2f5d92ca5afc118d3fb798c1f25863a5011a01'/>
<id>urn:sha1:5b2f5d92ca5afc118d3fb798c1f25863a5011a01</id>
<content type='text'>
Change the assertions added in bf3ff338a25 (parse-options: stop
abusing 'callback' for lowlevel callbacks, 2019-01-27) to use optbug()
instead of BUG(). At this point we're looping over individual options,
so if we encounter any issues we'd like to report the offending option.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options.c: use new bug() API for optbug()</title>
<updated>2022-06-02T19:51:35Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-06-02T12:25:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=53ca569419aed9706b052c48656715ab0b5f14fd'/>
<id>urn:sha1:53ca569419aed9706b052c48656715ab0b5f14fd</id>
<content type='text'>
When we run into bugs in parse-options.c usage it's good to be able to
note all the issues we ran into before dying. This use-case is why we
have the optbug() function introduced in 1e5ce570ca3 (parse-options:
clearer reporting of API misuse, 2010-12-02)

Let's change this code to use the new bug() API introduced in the
preceding commit, which cuts down on the verbosity of
parse_options_check().

There are existing uses of BUG() in adjacent code that should have
been using optbug() that aren't being changed here. That'll be done in
a subsequent commit. This only changes the optbug() callers.

Since this will invoke BUG() the previous exit(128) code will be
changed, but in this case that's what we want, i.e. to have
encountering a BUG() return the specific "BUG" exit code.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ja/i18n-common-messages'</title>
<updated>2022-02-25T23:47:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-25T23:47:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d21d5ddfe675f9dbcdbb94ab01776115a2d1fdde'/>
<id>urn:sha1:d21d5ddfe675f9dbcdbb94ab01776115a2d1fdde</id>
<content type='text'>
Unify more messages to help l10n.

* ja/i18n-common-messages:
  i18n: fix some misformated placeholders in command synopsis
  i18n: remove from i18n strings that do not hold translatable parts
  i18n: factorize "invalid value" messages
  i18n: factorize more 'incompatible options' messages
</content>
</entry>
<entry>
<title>Merge branch 'ab/cat-file'</title>
<updated>2022-02-05T17:42:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-05T17:42:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=008028a910b1bb820ad14b976665acf0f5cd4015'/>
<id>urn:sha1:008028a910b1bb820ad14b976665acf0f5cd4015</id>
<content type='text'>
Assorted updates to "git cat-file", especially "-h".

* ab/cat-file:
  cat-file: s/_/-/ in typo'd usage_msg_optf() message
  cat-file: don't whitespace-pad "(...)" in SYNOPSIS and usage output
  cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)
  object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLY
  cat-file: correct and improve usage information
  cat-file: fix remaining usage bugs
  cat-file: make --batch-all-objects a CMDMODE
  cat-file: move "usage" variable to cmd_cat_file()
  cat-file docs: fix SYNOPSIS and "-h" output
  parse-options API: add a usage_msg_optf()
  cat-file tests: test messaging on bad objects/paths
  cat-file tests: test bad usage
</content>
</entry>
<entry>
<title>i18n: factorize more 'incompatible options' messages</title>
<updated>2022-02-04T21:58:28Z</updated>
<author>
<name>Jean-Noël Avila</name>
<email>jn.avila@free.fr</email>
</author>
<published>2022-01-31T22:07:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a699367bb8749a338aefb092c5d7ac75c69d61e1'/>
<id>urn:sha1:a699367bb8749a338aefb092c5d7ac75c69d61e1</id>
<content type='text'>
Find more incompatible options to factorize.

When more than two options are mutually exclusive, print the ones
which are actually on the command line.

Signed-off-by: Jean-Noël Avila &lt;jn.avila@free.fr&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/usage-die-message'</title>
<updated>2022-01-10T19:52:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4b51386bbfc5d26e552c3c4be135e31cd2f64b44'/>
<id>urn:sha1:4b51386bbfc5d26e552c3c4be135e31cd2f64b44</id>
<content type='text'>
Code clean-up to hide vreportf() from public API.

* ab/usage-die-message:
  config API: use get_error_routine(), not vreportf()
  usage.c + gc: add and use a die_message_errno()
  gc: return from cmd_gc(), don't call exit()
  usage.c API users: use die_message() for error() + exit 128
  usage.c API users: use die_message() for "fatal :" + exit 128
  usage.c: add a die_message() routine
</content>
</entry>
<entry>
<title>parse-options API: add a usage_msg_optf()</title>
<updated>2021-12-30T21:05:28Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-12-28T13:28:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fa476be8f0963d4dd512eaf8ee23b3cd3986a500'/>
<id>urn:sha1:fa476be8f0963d4dd512eaf8ee23b3cd3986a500</id>
<content type='text'>
Add a usage_msg_optf() as a shorthand for the sort of
usage_msg_opt(xstrfmt(...)) used in builtin/stash.c. I'll make more
use of this function in builtin/cat-file.c shortly.

The disconnect between the "..." and "fmt" is a bit unusual, but it
works just fine and this keeps it consistent with usage_msg_opt(),
i.e. a caller of it can be moved to usage_msg_optf() and not have to
have its arguments re-arranged.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/parse-options-cleanup'</title>
<updated>2021-12-15T17:39:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-15T17:39:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bc32aa1e63218b0011159af4703e1389354c69f9'/>
<id>urn:sha1:bc32aa1e63218b0011159af4703e1389354c69f9</id>
<content type='text'>
Change the type of an internal function to return an enum (instead
of int) and replace -2 that was used to signal an error with -1.

* ab/parse-options-cleanup:
  parse-options.c: use "enum parse_opt_result" for parse_nodash_opt()
</content>
</entry>
<entry>
<title>usage.c API users: use die_message() for "fatal :" + exit 128</title>
<updated>2021-12-07T21:25:15Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-12-07T18:26:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e081a7c3b7290c50c817598e5f2686d068540762'/>
<id>urn:sha1:e081a7c3b7290c50c817598e5f2686d068540762</id>
<content type='text'>
Change code that printed its own "fatal: " message and exited with a
status code of 128 to use the die_message() function added in a
preceding commit.

This change also demonstrates why the return value of
die_message_routine() needed to be that of "report_fn". We have
callers such as the run-command.c::child_err_spew() which would like
to replace its error routine with the return value of
"get_die_message_routine()".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options.c: use "enum parse_opt_result" for parse_nodash_opt()</title>
<updated>2021-11-10T23:17:29Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-11-10T01:27:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68611f512c143c15b4a3b968bb5b6ceb933c9ca6'/>
<id>urn:sha1:68611f512c143c15b4a3b968bb5b6ceb933c9ca6</id>
<content type='text'>
Change the parse_nodash_opt() function to use "enum
parse_opt_result". In 352e761388b (parse-options.[ch]: consistently
use "enum parse_opt_result", 2021-10-08) its only caller
parse_options_step() started using that return type, and the
get_value() which will be called and return from it uses the same
enum.

Let's do the same here so that this function always returns an "enum
parse_opt_result" value.

We could go for either PARSE_OPT_HELP (-2) or PARSE_OPT_ERROR (-1)
here. The reason we ended up with "-2" is that in code added in
07fe54db3cd (parse-opt: do not print errors on unknown options, return
"-2" instead., 2008-06-23) we used that value in a meaningful way.

Then in 51a9949eda7 (parseopt: add PARSE_OPT_NODASH, 2009-05-07) the
use of "-2" was seemingly copy/pasted from parse_long_opt(), which was
the function immediately above the parse_nodash_opt() function added
in that commit.

Since we only care about whether the return value here is non-zero
let's use the more generic PARSE_OPT_ERROR.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
