<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/parse-options.c, branch gitk-resize-error</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=gitk-resize-error</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=gitk-resize-error'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2022-01-10T19:52:53Z</updated>
<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='http://git.kilabit.info/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>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='http://git.kilabit.info/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='http://git.kilabit.info/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='http://git.kilabit.info/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>
<entry>
<title>Merge branch 'ab/parse-options-cleanup'</title>
<updated>2021-11-09T21:19:06Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-11-09T21:19:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=84c99b20231e77fe1df7ea487e3dc24359cba028'/>
<id>urn:sha1:84c99b20231e77fe1df7ea487e3dc24359cba028</id>
<content type='text'>
Last minute fix to the update already in 'master'.

* ab/parse-options-cleanup:
  parse-options.[ch]: revert use of "enum" for parse_options()
</content>
</entry>
<entry>
<title>parse-options.[ch]: revert use of "enum" for parse_options()</title>
<updated>2021-11-09T17:45:37Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-11-09T11:04:43Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=06a199f38b50ccea198c29216c69bb389ca23391'/>
<id>urn:sha1:06a199f38b50ccea198c29216c69bb389ca23391</id>
<content type='text'>
Revert the parse_options() prototype change in my recent
352e761388b (parse-options.[ch]: consistently use "enum
parse_opt_result", 2021-10-08) was incorrect. The parse_options()
function returns the number of argc elements that haven't been
processed, not "enum parse_opt_result".

Reported-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
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-10-25T23:06:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-25T23:06:59Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=65ca3245f99e3595ac483e4af5b2ff34b7985635'/>
<id>urn:sha1:65ca3245f99e3595ac483e4af5b2ff34b7985635</id>
<content type='text'>
Random changes to parse-options implementation.

* ab/parse-options-cleanup:
  parse-options: change OPT_{SHORT,UNSET} to an enum
  parse-options tests: test optname() output
  parse-options.[ch]: make opt{bug,name}() "static"
  commit-graph: stop using optname()
  parse-options.c: move optname() earlier in the file
  parse-options.h: make the "flags" in "struct option" an enum
  parse-options.c: use exhaustive "case" arms for "enum parse_opt_result"
  parse-options.[ch]: consistently use "enum parse_opt_result"
  parse-options.[ch]: consistently use "enum parse_opt_flags"
  parse-options.h: move PARSE_OPT_SHELL_EVAL between enums
</content>
</entry>
<entry>
<title>Merge branch 'ab/align-parse-options-help'</title>
<updated>2021-10-13T22:15:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-13T22:15:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d7bc8521518d4821c5d2e18742991a6ad05efee1'/>
<id>urn:sha1:d7bc8521518d4821c5d2e18742991a6ad05efee1</id>
<content type='text'>
When "git cmd -h" shows more than one line of usage text (e.g.
the cmd subcommand may take sub-sub-command), parse-options API
learned to align these lines, even across i18n/l10n.

* ab/align-parse-options-help:
  parse-options: properly align continued usage output
  git rev-parse --parseopt tests: add more usagestr tests
  send-pack: properly use parse_options() API for usage string
  parse-options API users: align usage output in C-strings
</content>
</entry>
<entry>
<title>parse-options: change OPT_{SHORT,UNSET} to an enum</title>
<updated>2021-10-08T21:13:11Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-10-08T19:07:46Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d342834529495508fa1f23e223d4917cbdcfb54d'/>
<id>urn:sha1:d342834529495508fa1f23e223d4917cbdcfb54d</id>
<content type='text'>
Change the comparisons against OPT_SHORT and OPT_UNSET to an enum
which keeps track of how a given option got parsed. The case of "0"
was an implicit OPT_LONG, so let's add an explicit label for it.

Due to the xor in 0f1930c5875 (parse-options: allow positivation of
options starting, with no-, 2012-02-25) the code already relied on
this being set back to 0. To avoid refactoring the logic involved in
that let's just start the enum at "0" instead of the usual "1&lt;&lt;0" (1),
but BUG() out if we don't have one of our expected flags.

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.[ch]: make opt{bug,name}() "static"</title>
<updated>2021-10-08T21:13:11Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-10-08T19:07:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=28794ec72e284ba398b562bc117e091853ef0332'/>
<id>urn:sha1:28794ec72e284ba398b562bc117e091853ef0332</id>
<content type='text'>
Change these two functions to "static", the last user of "optname()"
outside of parse-options.c itself went away in the preceding commit,
for the reasons noted in 9440b831ad5 (parse-options: replace
opterror() with optname(), 2018-11-10) we shouldn't be adding any more
users of it.

The "optbug()" function was never used outside of parse-options.c, but
was made non-static in 1f275b7c4ca (parse-options: export opterr,
optbug, 2011-08-11). I think the only external user of optname() was
the commit-graph.c caller added in 09e0327f57 (builtin/commit-graph.c:
introduce '--max-new-filters=&lt;n&gt;', 2020-09-18).

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>
