<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/parse-options.c, branch v2.30.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.30.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.30.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-08-20T00:46:17Z</updated>
<entry>
<title>parse-options: add --git-completion-helper-all</title>
<updated>2020-08-20T00:46:17Z</updated>
<author>
<name>Ryan Zoeller</name>
<email>rtzoeller@rtzoeller.com</email>
</author>
<published>2020-08-19T23:06:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a0abe5e3b72c721a687ad9dc1a4a9bafe938c738'/>
<id>urn:sha1:a0abe5e3b72c721a687ad9dc1a4a9bafe938c738</id>
<content type='text'>
--git-completion-helper excludes hidden options, such as --allow-empty
for git commit. This is typically helpful, but occasionally we want
auto-completion for obscure flags. --git-completion-helper-all returns
all options, even if they are marked as hidden or nocomplete.

Signed-off-by: Ryan Zoeller &lt;rtzoeller@rtzoeller.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: teach "git cmd -h" to show alias as alias</title>
<updated>2020-03-16T21:27:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-16T20:22:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c280589cffa6f55f6bef0496776334f1e3cdcb5'/>
<id>urn:sha1:7c280589cffa6f55f6bef0496776334f1e3cdcb5</id>
<content type='text'>
There is a long-standing NEEDSWORK comment that complains about
inconsistency between how an aliased option ("git clone --recurse"
which is the only one that currently exists) gives a help text in
a usage-error message vs "git cmd -h").  Get rid of it and then
make sure we say an option is an alias for another, instead of
repeating the same short help text for both, which leads to "they
seem to do the same---is there any subtle difference?" puzzlement
to end-users.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pb/am-show-current-patch'</title>
<updated>2020-03-09T18:21:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-09T18:21:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0e0d717537547e8fcba441e4f65237c7fd227a34'/>
<id>urn:sha1:0e0d717537547e8fcba441e4f65237c7fd227a34</id>
<content type='text'>
"git am --short-current-patch" is a way to show the piece of e-mail
for the stopped step, which is not suitable to directly feed "git
apply" (it is designed to be a good "git am" input).  It learned a
new option to show only the patch part.

* pb/am-show-current-patch:
  am: support --show-current-patch=diff to retrieve .git/rebase-apply/patch
  am: support --show-current-patch=raw as a synonym for--show-current-patch
  am: convert "resume" variable to a struct
  parse-options: convert "command mode" to a flag
  parse-options: add testcases for OPT_CMDMODE()
</content>
</entry>
<entry>
<title>parse-options: convert "command mode" to a flag</title>
<updated>2020-02-20T21:20:40Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2020-02-20T14:15:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bc8620b44094e9fb6fc20d141678f9b845c19193'/>
<id>urn:sha1:bc8620b44094e9fb6fc20d141678f9b845c19193</id>
<content type='text'>
OPTION_CMDMODE is essentially OPTION_SET_INT plus an extra check that
the variable had not set before.  In order to allow custom processing
of the option, for example a "command mode" option that also has an
argument, it would be nice to use OPTION_CALLBACK and not have to rewrite
the extra check on incompatible options.  In other words, making the
processing of the option orthogonal to the "only one of these" behavior
provided by OPTION_CMDMODE.

Add a new flag that takes care of the check, and modify OPT_CMDMODE to
use it together with OPTION_SET_INT.  The new flag still requires that the
option value points to an int, but any OPTION_* value can be specified as
long as it does not require a non-int type for opt-&gt;value.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jb/parse-options-message-fix'</title>
<updated>2020-02-12T20:41:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-02-12T20:41:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db72f8c940b3c49286fb88958b3c50fe6f0d6319'/>
<id>urn:sha1:db72f8c940b3c49286fb88958b3c50fe6f0d6319</id>
<content type='text'>
Error message fix.

* jb/parse-options-message-fix:
  parse-options: lose an unnecessary space in an error message
</content>
</entry>
<entry>
<title>parse-options: lose an unnecessary space in an error message</title>
<updated>2020-02-05T18:49:29Z</updated>
<author>
<name>Jacques Bodin-Hullin</name>
<email>j.bodinhullin@monsieurbiz.com</email>
</author>
<published>2020-02-05T13:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=395518cf7a290f78232979593351d366a228e5c0'/>
<id>urn:sha1:395518cf7a290f78232979593351d366a228e5c0</id>
<content type='text'>
Signed-off-by: Jacques Bodin-Hullin &lt;j.bodinhullin@monsieurbiz.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>C: use skip_prefix() to avoid hardcoded string length</title>
<updated>2020-01-31T21:03:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-01-30T19:35:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=145136a95a8755528aa012a4ce0ed50d1ec39e24'/>
<id>urn:sha1:145136a95a8755528aa012a4ce0ed50d1ec39e24</id>
<content type='text'>
We often skip an optional prefix in a string with a hardcoded
constant, e.g.

	if (starts_with(string, "prefix"))
		string += 6;

which is less error prone when written

	skip_prefix(string, "prefix", &amp;string);

Note that this changes a few error messages from "git reflog expire
--expire=nonsense.timestamp", which used to complain by saying

    '--expire=nonsense.timestamp' is not a valid timestamp

but with this change, we say

    'nonsense.timestamp' is not a valid timestamp

which is more technically correct (the string with --expire= as
a prefix obviously cannot be a valid timestamp, but the error is
about the part of the input without that prefix).

Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Fix spelling errors in code comments</title>
<updated>2019-11-10T07:00:54Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2019-11-05T17:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=15beaaa3d1f6b555900446deb5e376b4f806d734'/>
<id>urn:sha1:15beaaa3d1f6b555900446deb5e376b4f806d734</id>
<content type='text'>
Reported-by: Jens Schleusener &lt;Jens.Schleusener@fossies.org&gt;
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: allow --end-of-options as a synonym for "--"</title>
<updated>2019-08-06T20:05:39Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-08-06T14:40:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=51b4594b4024d5cb2b4ace36ff932affa31c03f4'/>
<id>urn:sha1:51b4594b4024d5cb2b4ace36ff932affa31c03f4</id>
<content type='text'>
The revision option parser recently learned about --end-of-options, but
that's not quite enough for all callers. Some of them, like git-log,
pick out some options using parse_options(), and then feed the remainder
to setup_revisions(). For those cases we need to stop parse_options()
from finding more options when it sees --end-of-options, and to retain
that option in argv so that setup_revisions() can see it as well.

Let's handle this the same as we do "--". We can even piggy-back on the
handling of PARSE_OPT_KEEP_DASHDASH, because any caller that wants to
retain one will want to retain the other.

I've included two tests here. The "log" test covers "--source", which is
one of the options it handles with parse_options(), and would fail
before this patch. There's also a test that uses the parse-options
helper directly. That confirms that the option is handled correctly even
in cases without KEEP_DASHDASH or setup_revisions(). I.e., it is safe to
use --end-of-options in place of "--" in other programs.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/diff-parseopt'</title>
<updated>2019-05-30T17:50:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-05-30T17:50:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=20aa7c594fbc2e36476daae2f53d7c020306c62c'/>
<id>urn:sha1:20aa7c594fbc2e36476daae2f53d7c020306c62c</id>
<content type='text'>
A brown-paper-bag bugfix to a change already in 'master'.

* nd/diff-parseopt:
  parse-options: check empty value in OPT_INTEGER and OPT_ABBREV
  diff-parseopt: restore -U (no argument) behavior
  diff-parseopt: correct variable types that are used by parseopt
</content>
</entry>
</feed>
