<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/run-command.c, branch v2.12.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.12.0</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.12.0'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2017-02-02T21:36:57Z</updated>
<entry>
<title>Merge branch 'js/mingw-hooks-with-exe-suffix'</title>
<updated>2017-02-02T21:36:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-02T21:36:57Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7'/>
<id>urn:sha1:cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7</id>
<content type='text'>
Names of the various hook scripts must be spelled exactly, but on
Windows, an .exe binary must be named with .exe suffix; notice
$GIT_DIR/hooks/&lt;hookname&gt;.exe as a valid &lt;hookname&gt; hook.

* js/mingw-hooks-with-exe-suffix:
  mingw: allow hooks to be .exe files
</content>
</entry>
<entry>
<title>mingw: allow hooks to be .exe files</title>
<updated>2017-01-30T16:49:43Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2017-01-30T12:28:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=235be51fbecbbdaafd48f762e808c55861e02850'/>
<id>urn:sha1:235be51fbecbbdaafd48f762e808c55861e02850</id>
<content type='text'>
Executable files in Windows need to have the extension '.exe', otherwise
they do not work. Extend the hooks to not just look at the hard coded
names, but also at the names extended by the custom STRIP_EXTENSION,
which is defined as '.exe' in Windows.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>execv_dashed_external: wait for child on signal death</title>
<updated>2017-01-09T21:41:40Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-01-07T01:22:23Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=46df6906f3aaf74dafe2026b028c8c5c1a0d5f58'/>
<id>urn:sha1:46df6906f3aaf74dafe2026b028c8c5c1a0d5f58</id>
<content type='text'>
When you hit ^C to interrupt a git command going to a pager,
this usually leaves the pager running. But when a dashed
external is in use, the pager ends up in a funny state and
quits (but only after eating one more character from the
terminal!). This fixes it.

Explaining the reason will require a little background.

When git runs a pager, it's important for the git process to
hang around and wait for the pager to finish, even though it
has no more data to feed it. This is because git spawns the
pager as a child, and thus the git process is the session
leader on the terminal. After it dies, the pager will finish
its current read from the terminal (eating the one
character), and then get EIO trying to read again.

When you hit ^C, that sends SIGINT to git and to the pager,
and it's a similar situation.  The pager ignores it, but the
git process needs to hang around until the pager is done. We
addressed that long ago in a3da882120 (pager: do
wait_for_pager on signal death, 2009-01-22).

But when you have a dashed external (or an alias pointing to
a builtin, which will re-exec git for the builtin), there's
an extra process in the mix. For instance, running:

  $ git -c alias.l=log l

will end up with a process tree like:

  git (parent)
    \
     git-log (child)
      \
       less (pager)

If you hit ^C, SIGINT goes to all of them. The pager ignores
it, and the child git process will end up in wait_for_pager().
But the parent git process will die, and the usual EIO
trouble happens.

So we really want the parent git process to wait_for_pager(),
but of course it doesn't know anything about the pager at
all, since it was started by the child.  However, we can
have it wait on the git-log child, which in turn is waiting
on the pager. And that's what this patch does.

There are a few design decisions here worth explaining:

  1. The new feature is attached to run-command's
     clean_on_exit feature. Partly this is convenience,
     since that feature already has a signal handler that
     deals with child cleanup.

     But it's also a meaningful connection. The main reason
     that dashed externals use clean_on_exit is to bind the
     two processes together. If somebody kills the parent
     with a signal, we propagate that to the child (in this
     instance with SIGINT, we do propagate but it doesn't
     matter because the original signal went to the whole
     process group). Likewise, we do not want the parent
     to go away until the child has done so.

     In a traditional Unix world, we'd probably accomplish
     this binding by just having the parent execve() the
     child directly. But since that doesn't work on Windows,
     everything goes through run_command's more spawn-like
     interface.

  2. We do _not_ automatically waitpid() on any
     clean_on_exit children. For dashed externals this makes
     sense; we know that the parent is doing nothing but
     waiting for the child to exit anyway. But with other
     children, it's possible that the child, after getting
     the signal, could be waiting on the parent to do
     something (like closing a descriptor). If we were to
     wait on such a child, we'd end up in a deadlock. So
     this errs on the side of caution, and lets callers
     enable the feature explicitly.

  3. When we send children the cleanup signal, we send all
     the signals first, before waiting on any children. This
     is to avoid the case where one child might be waiting
     on another one to exit, causing a deadlock. We inform
     all of them that it's time to die before reaping any.

     In practice, there is only ever one dashed external run
     from a given process, so this doesn't matter much now.
     But it future-proofs us if other callers start using
     the wait_after_clean mechanism.

There's no automated test here, because it would end up racy
and unportable. But it's easy to reproduce the situation by
running the log command given above and hitting ^C.

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>run-command: add clean_on_exit_handler</title>
<updated>2016-10-17T18:36:50Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-16T23:20:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ac2fbaa674ce3d5b5faf6a83f88cc4af1654f9cd'/>
<id>urn:sha1:ac2fbaa674ce3d5b5faf6a83f88cc4af1654f9cd</id>
<content type='text'>
Some processes might want to perform cleanup tasks before Git kills them
due to the 'clean_on_exit' flag. Let's give them an interface for doing
this. The feature is used in a subsequent patch.

Please note, that the cleanup callback is not executed if Git dies of a
signal. The reason is that only "async-signal-safe" functions would be
allowed to be call in that case. Since we cannot control what functions
the callback will use, we will not support the case. See 507d7804 for
more details.

Helped-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command: move check_pipe() from write_or_die to run_command</title>
<updated>2016-10-17T18:36:49Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-16T23:20:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b992fe104ecde5a362a31d610de96518f398d5c0'/>
<id>urn:sha1:b992fe104ecde5a362a31d610de96518f398d5c0</id>
<content type='text'>
Move check_pipe() to run_command and make it public. This is necessary
to call the function from pkt-line in a subsequent patch.

While at it, make async_exit() static to run_command.c as it is no
longer used from outside.

Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Ramsay Jones &lt;ramsay@ramsayjones.plus.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/hooks'</title>
<updated>2016-08-19T22:34:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-08-19T22:34:16Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=d05d0e99665ecb67c3e8b9b3be40b12e9052a8b8'/>
<id>urn:sha1:d05d0e99665ecb67c3e8b9b3be40b12e9052a8b8</id>
<content type='text'>
"git rev-parse --git-path hooks/&lt;hook&gt;" learned to take
core.hooksPath configuration variable (introduced during 2.9 cycle)
into account.

* ab/hooks:
  rev-parse: respect core.hooksPath in --git-path
</content>
</entry>
<entry>
<title>rev-parse: respect core.hooksPath in --git-path</title>
<updated>2016-08-16T19:03:26Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2016-08-16T13:14:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=9445b4921e3e996b2d38d58c594f95d63a72dcea'/>
<id>urn:sha1:9445b4921e3e996b2d38d58c594f95d63a72dcea</id>
<content type='text'>
The idea of the --git-path option is not only to avoid having to
prefix paths with the output of --git-dir all the time, but also to
respect overrides for specific common paths inside the .git directory
(e.g. `git rev-parse --git-path objects` will report the value of the
environment variable GIT_OBJECT_DIRECTORY, if set).

When introducing the core.hooksPath setting, we forgot to adjust
git_path() accordingly. This patch fixes that.

While at it, revert the special-casing of core.hooksPath in
run-command.c, as it is now no longer needed.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command: add pipe_command helper</title>
<updated>2016-06-18T00:03:56Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-06-17T23:38:47Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=96335bcf4d64c29add3692fb41671190123cf44e'/>
<id>urn:sha1:96335bcf4d64c29add3692fb41671190123cf44e</id>
<content type='text'>
We already have capture_command(), which captures the stdout
of a command in a way that avoids deadlocks. But sometimes
we need to do more I/O, like capturing stderr as well, or
sending data to stdin. It's easy to write code that
deadlocks racily in these situations depending on how fast
the command reads its input, or in which order it writes its
output.

Let's give callers an easy interface for doing this the
right way, similar to what capture_command() did for the
simple case.

The whole thing is backed by a generic poll() loop that can
feed an arbitrary number of buffers to descriptors, and fill
an arbitrary number of strbufs from other descriptors. This
seems like overkill, but the resulting code is actually a
bit cleaner than just handling the three descriptors
(because the output code for stdout/stderr is effectively
duplicated, so being able to loop is a benefit).

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/error-errno'</title>
<updated>2016-05-17T21:38:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-05-17T21:38:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=40cfc95856594ddd04ae6ef3bfd041346c4854ec'/>
<id>urn:sha1:40cfc95856594ddd04ae6ef3bfd041346c4854ec</id>
<content type='text'>
The code for warning_errno/die_errno has been refactored and a new
error_errno() reporting helper is introduced.

* nd/error-errno: (41 commits)
  wrapper.c: use warning_errno()
  vcs-svn: use error_errno()
  upload-pack.c: use error_errno()
  unpack-trees.c: use error_errno()
  transport-helper.c: use error_errno()
  sha1_file.c: use {error,die,warning}_errno()
  server-info.c: use error_errno()
  sequencer.c: use error_errno()
  run-command.c: use error_errno()
  rerere.c: use error_errno() and warning_errno()
  reachable.c: use error_errno()
  mailmap.c: use error_errno()
  ident.c: use warning_errno()
  http.c: use error_errno() and warning_errno()
  grep.c: use error_errno()
  gpg-interface.c: use error_errno()
  fast-import.c: use error_errno()
  entry.c: use error_errno()
  editor.c: use error_errno()
  diff-no-index.c: use error_errno()
  ...
</content>
</entry>
<entry>
<title>Merge branch 'ab/hooks'</title>
<updated>2016-05-17T21:38:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-05-17T21:38:17Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=6675f501f6b987dbdb0dbeb1d2efeb5a27fc41a7'/>
<id>urn:sha1:6675f501f6b987dbdb0dbeb1d2efeb5a27fc41a7</id>
<content type='text'>
A new configuration variable core.hooksPath allows customizing
where the hook directory is.

* ab/hooks:
  hooks: allow customizing where the hook directory is
  githooks.txt: minor improvements to the grammar &amp; phrasing
  githooks.txt: amend dangerous advice about 'update' hook ACL
  githooks.txt: improve the intro section
</content>
</entry>
</feed>
