<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/parse-options.h, branch v2.20.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.20.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.20.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-12-15T03:24:33Z</updated>
<entry>
<title>Merge branch 'nd/show-gitcomp-compilation-fix' into maint</title>
<updated>2018-12-15T03:24:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-12-15T03:24:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf29f074ed7019abb53398c4cd5659d9f939d9a8'/>
<id>urn:sha1:bf29f074ed7019abb53398c4cd5659d9f939d9a8</id>
<content type='text'>
Portability fix for a recent update to parse-options API.

* nd/show-gitcomp-compilation-fix:
  parse-options: fix SunCC compiler warning
</content>
</entry>
<entry>
<title>parse-options: fix SunCC compiler warning</title>
<updated>2018-12-12T08:21:33Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-12-11T15:35:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a92ec7efe0ad25f1c2047230c0324dcb54ce1cfc'/>
<id>urn:sha1:a92ec7efe0ad25f1c2047230c0324dcb54ce1cfc</id>
<content type='text'>
The compiler reports this because show_gitcomp() never actually
returns a value:

    "parse-options.c", line 520: warning: Function has no return
    statement : show_gitcomp

We could shut the compiler up. But instead let's not bury exit() too
deep. Do the same as internal -h handling, return a special error code
and handle the exit() in parse_options() (and other
parse_options_step() callers) instead.

Reported-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>assert NOARG/NONEG behavior of parse-options callbacks</title>
<updated>2018-11-06T03:56:29Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-05T06:45:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=517fe807d6903c629a739b23fe0e75b892096998'/>
<id>urn:sha1:517fe807d6903c629a739b23fe0e75b892096998</id>
<content type='text'>
When we define a parse-options callback, the flags we put in the option
struct must match what the callback expects. For example, a callback
which does not handle the "unset" parameter should only be used with
PARSE_OPT_NONEG. But since the callback and the option struct are not
defined next to each other, it's easy to get this wrong (as earlier
patches in this series show).

Fortunately, the compiler can help us here: compiling with
-Wunused-parameters can show us which callbacks ignore their "unset"
parameters (and likewise, ones that ignore "arg" expect to be triggered
with PARSE_OPT_NOARG).

But after we've inspected a callback and determined that all of its
callers use the right flags, what do we do next? We'd like to silence
the compiler warning, but do so in a way that will catch any wrong calls
in the future.

We can do that by actually checking those variables and asserting that
they match our expectations. Because this is such a common pattern,
we'll introduce some helper macros. The resulting messages aren't
as descriptive as we could make them, but the file/line information from
BUG() is enough to identify the problem (and anyway, the point is that
these should never be seen).

Each of the annotated callbacks in this patch triggers
-Wunused-parameters, and was manually inspected to make sure all callers
use the correct options (so none of these BUGs should be triggerable).

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>parse-options: drop OPT_DATE()</title>
<updated>2018-11-06T03:56:14Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-05T06:44:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0a8a16ade6b3a55114cd0f28e5e71c2a3483d825'/>
<id>urn:sha1:0a8a16ade6b3a55114cd0f28e5e71c2a3483d825</id>
<content type='text'>
There are no users of OPT_DATE except for test-parse-options; its
only caller went away in 27ec394a97 (prune: introduce OPT_EXPIRY_DATE()
and use it, 2013-04-25).

It also has a bug: it does not specify PARSE_OPT_NONEG, but its callback
does not respect the "unset" flag, and will feed NULL to approxidate()
and segfault. Probably this should be marked with NONEG, or the callback
should set the timestamp to some sentinel value (e.g,. "0", or
"(time_t)-1").

But since there are no callers, deleting it means we don't even have to
think about what the right behavior should be.

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 'ps/contains-id-error-message'</title>
<updated>2018-04-10T07:28:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-10T07:28:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=62c0fd46a875050e904831a73ef4375ed26cfaf6'/>
<id>urn:sha1:62c0fd46a875050e904831a73ef4375ed26cfaf6</id>
<content type='text'>
"git tag --contains no-such-commit" gave a full list of options
after giving an error message.

* ps/contains-id-error-message:
  parse-options: do not show usage upon invalid option value
</content>
</entry>
<entry>
<title>parse-options: do not show usage upon invalid option value</title>
<updated>2018-03-22T19:10:08Z</updated>
<author>
<name>Paul-Sebastian Ungureanu</name>
<email>ungureanupaulsebastian@gmail.com</email>
</author>
<published>2018-03-22T18:43:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3bb0923f06c55ea44569f547cefa9e1a59069ff2'/>
<id>urn:sha1:3bb0923f06c55ea44569f547cefa9e1a59069ff2</id>
<content type='text'>
Usually, the usage should be shown only if the user does not know what
options are available. If the user specifies an invalid value, the user
is already aware of the available options. In this case, there is no
point in displaying the usage anymore.

This patch applies to "git tag --contains", "git branch --contains",
"git branch --points-at", "git for-each-ref --contains" and many more.

Signed-off-by: Paul-Sebastian Ungureanu &lt;ungureanupaulsebastian@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate</title>
<updated>2018-03-07T19:02:48Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-03-07T01:05:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b475e442e8ec64e77acd7cb8c9c9bb321a76e82d'/>
<id>urn:sha1:b475e442e8ec64e77acd7cb8c9c9bb321a76e82d</id>
<content type='text'>
There is not a strong reason to hide this option, and git-merge already
completes this one. Let's allow to complete this for all commands (and
let git-completion.bash do the suppressing if needed).

This makes --rerere-autoupdate completable for am, cherry-pick and
revert. rebase completion is fixed manually because it's a shell
script and does not benefit from --git-completion-helper.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote: force completing --mirror= instead of --mirror</title>
<updated>2018-02-09T18:24:52Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-02-09T11:02:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ebc4a04e8437e704e40a1d35aea030dc03ec8e56'/>
<id>urn:sha1:ebc4a04e8437e704e40a1d35aea030dc03ec8e56</id>
<content type='text'>
"git remote --mirror" is a special case. Technically it is possible to
specify --mirror without any argument. But we will get a "dangerous,
deprecated!" warning in that case.

This new parse-opt flag allows --git-completion-helper to always
complete --mirror=, ignoring the dangerous use case.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: use __gitcomp_builtin in _git_am</title>
<updated>2018-02-09T18:24:50Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-02-09T11:01:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=be3ce6b2505467d445c671feeb76e7ad1c40aee7'/>
<id>urn:sha1:be3ce6b2505467d445c671feeb76e7ad1c40aee7</id>
<content type='text'>
The new completable options are:

--directory
--exclude
--gpg-sign
--include
--keep-cr
--keep-non-patch
--message-id
--no-keep-cr
--patch-format
--quiet
--reject
--resolvemsg=

In-progress options like --continue will be part of --git-completion-helper
then filtered out by _git_am() unless the operation is in progress. This
helps keep marking of these operations in just one place.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: let OPT__FORCE take optional flags argument</title>
<updated>2018-02-09T18:24:50Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-02-09T11:01:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1224781d6080b8b69a81526ee23b22a1587920ea'/>
<id>urn:sha1:1224781d6080b8b69a81526ee23b22a1587920ea</id>
<content type='text'>
--force option is most likely hidden from command line completion for
safety reasons. This is done by adding an extra flag
PARSE_OPT_NOCOMPLETE. Update OPT__FORCE() to accept additional
flags. Actual flag change comes later depending on individual
commands.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
