<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/parse-options.c, branch v1.7.7.4</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.7.7.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.7.7.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2011-08-11T19:18:02Z</updated>
<entry>
<title>Reduce parse-options.o dependencies</title>
<updated>2011-08-11T19:18:02Z</updated>
<author>
<name>Dmitry Ivankov</name>
<email>divanorama@gmail.com</email>
</author>
<published>2011-08-11T09:15:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=068762846634dff73a18d71188736e0ded03a1cc'/>
<id>urn:sha1:068762846634dff73a18d71188736e0ded03a1cc</id>
<content type='text'>
Currently parse-options.o pulls quite a big bunch of dependencies.
his complicates it's usage in contrib/ because it pulls external
dependencies and it also increases executables size.

Split off less generic and more internal to git part of
parse-options.c to parse-options-cb.c.

Move prefix_filename function from setup.c to abspath.c. abspath.o
and wrapper.o pull each other, so it's unlikely to increase the
dependencies. It was a dependency of parse-options.o that pulled
many others.

Now parse-options.o pulls just abspath.o, ctype.o, strbuf.o, usage.o,
wrapper.o, libc directly and strlcpy.o indirectly.

Signed-off-by: Dmitry Ivankov &lt;divanorama@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: export opterr, optbug</title>
<updated>2011-08-11T19:18:02Z</updated>
<author>
<name>Dmitry Ivankov</name>
<email>divanorama@gmail.com</email>
</author>
<published>2011-08-11T09:15:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=1f275b7c4caebf8ca5c002458f0f1b7994548a97'/>
<id>urn:sha1:1f275b7c4caebf8ca5c002458f0f1b7994548a97</id>
<content type='text'>
opterror and optbug functions are used by some of parsing routines
in parse-options.c to report errors and bugs respectively.

Export these functions to allow more custom parsing routines to use
them in a uniform way.

Signed-off-by: Dmitry Ivankov &lt;divanorama@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: add OPT_STRING_LIST helper</title>
<updated>2011-06-22T18:25:20Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2011-06-09T15:55:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=c8ba163916554e9ffd3ce8cb2beeff003d90c0c3'/>
<id>urn:sha1:c8ba163916554e9ffd3ce8cb2beeff003d90c0c3</id>
<content type='text'>
This just adds repeated invocations of an option to a list
of strings. Using the "--no-&lt;var&gt;" form will reset the list
to empty.

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>Fix sparse warnings</title>
<updated>2011-03-22T17:16:54Z</updated>
<author>
<name>Stephen Boyd</name>
<email>bebarino@gmail.com</email>
</author>
<published>2011-03-22T07:51:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=c2e86addb86689306b992065328ec52aa2479658'/>
<id>urn:sha1:c2e86addb86689306b992065328ec52aa2479658</id>
<content type='text'>
Fix warnings from 'make check'.

 - These files don't include 'builtin.h' causing sparse to complain that
   cmd_* isn't declared:

   builtin/clone.c:364, builtin/fetch-pack.c:797,
   builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
   builtin/merge-index.c:69, builtin/merge-recursive.c:22
   builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
   builtin/notes.c:822, builtin/pack-redundant.c:596,
   builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
   builtin/remote.c:1512, builtin/remote-ext.c:240,
   builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
   builtin/unpack-file.c:25, builtin/var.c:75

 - These files have symbols which should be marked static since they're
   only file scope:

   submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
   submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
   unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
   url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48

 - These files redeclare symbols to be different types:

   builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
   usage.c:49, usage.c:58, usage.c:63, usage.c:72

 - These files use a literal integer 0 when they really should use a NULL
   pointer:

   daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362

While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).

Signed-off-by: Stephen Boyd &lt;bebarino@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: make resuming easier after PARSE_OPT_STOP_AT_NON_OPTION</title>
<updated>2010-12-07T22:19:32Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2010-12-01T23:32:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=979240fee32628c317998f3c3fe2619cf01decc2'/>
<id>urn:sha1:979240fee32628c317998f3c3fe2619cf01decc2</id>
<content type='text'>
Introduce a PARSE_OPT_NON_OPTION state, so parse_option_step()
callers can easily distinguish between non-options and other
reasons for option parsing termination (like "--").

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: allow git commands to invent new option types</title>
<updated>2010-12-07T22:19:32Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2010-12-01T23:32:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=b0b3a8b666ac9bcab93c9b05ca7de918d7fa18bc'/>
<id>urn:sha1:b0b3a8b666ac9bcab93c9b05ca7de918d7fa18bc</id>
<content type='text'>
parse-options provides a variety of option behaviors, including
OPTION_CALLBACK, which should take care of just about any sane
behavior.  All supported behaviors obey the following constraint:

 A --foo option can only accept (and base its behavior on)
 one argument, which would be the following command-line
 argument in the "unsticked" form.

Alas, some existing git commands have options that do not obey that
constraint.  For example, update-index --cacheinfo takes three
arguments, and update-index --resolve takes all later parameters as
arguments.

Introduces an OPTION_LOWLEVEL_CALLBACK backdoor to parse-options so
such option types can be supported without tempting inventors of other
commands through mention in the public API.  Commands can set the
callback field to a function accepting three arguments: the option
parsing context, the option itself, and a flag indicating whether the
the option was negated.  When the option is encountered, that function
is called to take over from get_value().  The return value should be
zero for success, -1 for usage errors.

Thanks to Stephen Boyd for API guidance.

Improved-by: Stephen Boyd &lt;bebarino@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: never suppress arghelp if LITERAL_ARGHELP is set</title>
<updated>2010-12-07T22:19:32Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2010-12-01T23:31:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=b57c68a69e028cc41eb01404dc4446a463c0e464'/>
<id>urn:sha1:b57c68a69e028cc41eb01404dc4446a463c0e464</id>
<content type='text'>
The PARSE_OPT_LITERAL_ARGHELP flag allows a program to override the
standard "&lt;argument&gt; for mandatory, [argument] for optional" markup in
its help message.  Extend it to override the usual "no text for
disallowed", too (for the PARSE_OPT_NOARG | PARSE_OPT_LITERAL_ARGHELP
case, which was previously meaningless), to be more intuitive.

The motivation is to allow update-index to correctly advertise

	--cacheinfo &lt;mode&gt; &lt;object&gt; &lt;path&gt;
	                      add the specified entry to the index

while abusing PARSE_OPT_NOARG to disallow the "sticked form"

	--cacheinfo=&lt;mode&gt; &lt;object&gt; &lt;path&gt;

Noticed-by: Stephen Boyd &lt;bebarino@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: do not infer PARSE_OPT_NOARG from option type</title>
<updated>2010-12-07T22:19:32Z</updated>
<author>
<name>Stephen Boyd</name>
<email>bebarino@gmail.com</email>
</author>
<published>2010-12-01T23:30:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=c1f4ec9ef45232d6dbdea4c417a9d41eb8ad7f4f'/>
<id>urn:sha1:c1f4ec9ef45232d6dbdea4c417a9d41eb8ad7f4f</id>
<content type='text'>
Simplify the "takes no value" error path by relying on PARSE_OPT_NOARG
being set correctly.  That is:

 - if the PARSE_OPT_NOARG flag is set, reject --opt=value
   regardless of the option type;
 - if the PARSE_OPT_NOARG flag is unset, accept --opt=value
   regardless of the option type.

This way, the accepted usage more closely matches the usage advertised
with --help-all.

No functional change intended, since the NOARG flag is only used
with "boolean-only" option types in existing parse_options callers.

Signed-off-by: Stephen Boyd &lt;bebarino@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: sanity check PARSE_OPT_NOARG flag</title>
<updated>2010-12-07T22:19:10Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2010-12-02T06:08:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=5c400ed2e05070d79b6cd9438ff5607ec0a83589'/>
<id>urn:sha1:5c400ed2e05070d79b6cd9438ff5607ec0a83589</id>
<content type='text'>
Some option types cannot use an argument --- boolean options that
would set a bit or flag or increment a counter, for example.  If
configured in the flag word to accept an argument anyway, the result
is an argument that is advertised in "program -h" output only to be
rejected by parse-options::get_value.

Luckily all current users of these option types use PARSE_OPT_NOARG
and do not use PARSE_OPT_OPTARG.  Add a check to ensure that that
remains true.  The check is run once for each invocation of
parse_option_start().

Improved-by: Stephen Boyd &lt;bebarino@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: move NODASH sanity checks to parse_options_check</title>
<updated>2010-12-07T22:17:49Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2010-12-02T06:05:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=a02dd4ff7dd79eb6aa39b00c90c293e3c3d10b4c'/>
<id>urn:sha1:a02dd4ff7dd79eb6aa39b00c90c293e3c3d10b4c</id>
<content type='text'>
A dashless switch (like '(' passed to 'git grep') cannot be negated,
cannot be attached to an argument, and cannot have a long form.
Currently parse-options runs the related sanity checks when the
dashless option is used; better to always check them at the start of
option parsing, so mistakes can be caught more quickly.

The error message at the new call site is less specific about the
nature of the error, for simplicity.  On the other hand, it prints
which switch was problematic.  Before:

	fatal: BUG: dashless options can't be long

After:

	error: BUG: switch '(' uses feature not supported for dashless options

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
