<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/usage.c, branch v2.11.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.11.4</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.11.4'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2016-09-19T20:47:18Z</updated>
<entry>
<title>Merge branch 'cc/apply-am'</title>
<updated>2016-09-19T20:47:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-09-19T20:47:17Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=81358dc238372793b1590efa149cc1581d1fbd98'/>
<id>urn:sha1:81358dc238372793b1590efa149cc1581d1fbd98</id>
<content type='text'>
"git am" has been taught to make an internal call to "git apply"'s
innards without spawning the latter as a separate process.

* cc/apply-am: (41 commits)
  builtin/am: use apply API in run_apply()
  apply: learn to use a different index file
  apply: pass apply state to build_fake_ancestor()
  apply: refactor `git apply` option parsing
  apply: change error_routine when silent
  usage: add get_error_routine() and get_warn_routine()
  usage: add set_warn_routine()
  apply: don't print on stdout in verbosity_silent mode
  apply: make it possible to silently apply
  apply: use error_errno() where possible
  apply: make some parsing functions static again
  apply: move libified code from builtin/apply.c to apply.{c,h}
  apply: rename and move opt constants to apply.h
  builtin/apply: rename option parsing functions
  builtin/apply: make create_one_file() return -1 on error
  builtin/apply: make try_create_file() return -1 on error
  builtin/apply: make write_out_results() return -1 on error
  builtin/apply: make write_out_one_result() return -1 on error
  builtin/apply: make create_file() return -1 on error
  builtin/apply: make add_index_file() return -1 on error
  ...
</content>
</entry>
<entry>
<title>usage: add get_error_routine() and get_warn_routine()</title>
<updated>2016-09-07T19:29:53Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2016-09-04T20:18:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=725149beab088b1368cc01aa3f1a7845db14132d'/>
<id>urn:sha1:725149beab088b1368cc01aa3f1a7845db14132d</id>
<content type='text'>
Let's make it possible to get the current error_routine and warn_routine,
so that we can store them before using set_error_routine() or
set_warn_routine() to use new ones.

This way we will be able put back the original routines, when we are done
with using new ones.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>usage: add set_warn_routine()</title>
<updated>2016-09-07T19:29:53Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2016-09-04T20:18:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b83f108b082dfd5452d5c1ab03596fa13750d23f'/>
<id>urn:sha1:b83f108b082dfd5452d5c1ab03596fa13750d23f</id>
<content type='text'>
There are already set_die_routine() and set_error_routine(),
so let's add set_warn_routine() as this will be needed in a
following commit.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>error_errno: use constant return similar to error()</title>
<updated>2016-08-31T18:11:54Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-08-31T03:41:22Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=4df5e91867498f7c6ee4bf5a464a5c24dc89034b'/>
<id>urn:sha1:4df5e91867498f7c6ee4bf5a464a5c24dc89034b</id>
<content type='text'>
Commit e208f9c (make error()'s constant return value more
visible, 2012-12-15) introduced some macro trickery to make
the constant return from error() more visible to callers,
which in turn can help gcc produce better warnings (and
possibly even better code).

Later, fd1d672 (usage.c: add warning_errno() and
error_errno(), 2016-05-08) introduced another variant, and
subsequent commits converted some uses of error() to
error_errno(), losing the magic from e208f9c for those
sites.

As a result, compiling vcs-svn/svndiff.c with "gcc -O3"
produces -Wmaybe-uninitialized false positives (at least
with gcc 6.2.0). Let's give error_errno() the same
treatment, which silences these warnings.

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>usage.c: add warning_errno() and error_errno()</title>
<updated>2016-05-09T19:29:08Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-05-08T09:47:22Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=fd1d672300f36b2b06c2951ec450de0cf8f17797'/>
<id>urn:sha1:fd1d672300f36b2b06c2951ec450de0cf8f17797</id>
<content type='text'>
Similar to die_errno(), these functions will append strerror()
automatically.

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>usage.c: move format processing out of die_errno()</title>
<updated>2016-05-09T19:29:08Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-05-08T09:47:21Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=58e4e5118ae3707b417a19e8dc9224ac25c3f32f'/>
<id>urn:sha1:58e4e5118ae3707b417a19e8dc9224ac25c3f32f</id>
<content type='text'>
fmt_with_err() will be shared with the coming error_errno() and
warning_errno().

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>vreportf: avoid intermediate buffer</title>
<updated>2015-08-11T21:29:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-11T18:13:59Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=f4c3edc0b156362a92bf9de4f0ec794e90a757fc'/>
<id>urn:sha1:f4c3edc0b156362a92bf9de4f0ec794e90a757fc</id>
<content type='text'>
When we call "die(fmt, args...)", we end up in vreportf with
two pieces of information:

  1. The prefix "fatal: "

  2. The original fmt and va_list of args.

We format item (2) into a temporary buffer, and then fprintf
the prefix and the temporary buffer, along with a newline.
This has the unfortunate side effect of truncating any error
messages that are longer than 4096 bytes.

Instead, let's use separate calls for the prefix and
newline, letting us hand the item (2) directly to vfprintf.
This is essentially undoing d048a96 (print
warning/error/fatal messages in one shot, 2007-11-09), which
tried to have the whole output end up in a single `write`
call.

But we can address this instead by explicitly requesting
line-buffering for the output handle, and by making sure
that the buffer is empty before we start (so that outputting
the prefix does not cause a flush due to hitting the buffer
limit).

We may still break the output into two writes if the content
is larger than our buffer, but there's not much we can do
there; depending on the stdio implementation, that might
have happened even with a single fprintf call.

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>vreportf: report to arbitrary filehandles</title>
<updated>2015-08-11T21:24:50Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-11T18:06:15Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3b331e92671469614662830402103848a8004b97'/>
<id>urn:sha1:3b331e92671469614662830402103848a8004b97</id>
<content type='text'>
The vreportf function always goes to stderr, but run-command
wants child errors to go to the parent's original stderr. To
solve this, commit a5487dd duplicates the stderr fd and
installs die and error handlers to direct the output
appropriately (which later turned into the vwritef
function). This has two downsides, though:

  - we make multiple calls to write(), which contradicts the
    "write at once" logic from d048a96 (print
    warning/error/fatal messages in one shot, 2007-11-09).

  - the custom handlers basically duplicate the normal
    handlers.  They're only a few lines of code, but we
    should not have to repeat the magic "exit(128)", for
    example.

We can solve the first by using fdopen() on the duplicated
descriptor. We can't pass this to vreportf, but we could
introduce a new vreportf_to to handle it.

However, to fix the second problem, we instead introduce a
new "set_error_handle" function, which lets the normal
vreportf calls output to a handle besides stderr. Thus we
can get rid of our custom handlers entirely, and just ask
the regular handlers to output to our new descriptor.

And as vwritef has no more callers, it can just go away.

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 'jk/a-thread-only-dies-once'</title>
<updated>2013-04-19T20:45:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-04-19T20:45:04Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=9526aa461f6c6900cb892a6fe248150ad436c0d5'/>
<id>urn:sha1:9526aa461f6c6900cb892a6fe248150ad436c0d5</id>
<content type='text'>
A regression fix for the logic to detect die() handler triggering
itself recursively.

* jk/a-thread-only-dies-once:
  run-command: use thread-aware die_is_recursing routine
  usage: allow pluggable die-recursion checks
</content>
</entry>
<entry>
<title>usage: allow pluggable die-recursion checks</title>
<updated>2013-04-16T22:02:46Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-04-16T19:46:22Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c19a490e37181de8fa94ae1074af4b9f9a518f95'/>
<id>urn:sha1:c19a490e37181de8fa94ae1074af4b9f9a518f95</id>
<content type='text'>
When any git code calls die or die_errno, we use a counter
to detect recursion into the die functions from any of the
helper functions. However, such a simple counter is not good
enough for threaded programs, which may call die from a
sub-thread, killing only the sub-thread (but incrementing
the counter for everyone).

Rather than try to deal with threads ourselves here, let's
just allow callers to plug in their own recursion-detection
function. This is similar to how we handle the die routine
(the caller plugs in a die routine which may kill only the
sub-thread).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
