<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/run-command.c, branch v1.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v1.6.2</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v1.6.2'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2009-02-03T08:26:12Z</updated>
<entry>
<title>Merge branch 'jk/maint-cleanup-after-exec-failure'</title>
<updated>2009-02-03T08:26:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-02-03T08:26:12Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=1487eb68f7fd145151caa9a11ee00283629b75ef'/>
<id>urn:sha1:1487eb68f7fd145151caa9a11ee00283629b75ef</id>
<content type='text'>
* jk/maint-cleanup-after-exec-failure:
  git: use run_command() to execute dashed externals
  run_command(): help callers distinguish errors
  run_command(): handle missing command errors more gracefully
  git: s/run_command/run_builtin/
</content>
</entry>
<entry>
<title>run_command(): handle missing command errors more gracefully</title>
<updated>2009-01-28T22:08:57Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2009-01-28T07:35:33Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=45c0961c87884a04517b65c0acc6aedeeae2d0c8'/>
<id>urn:sha1:45c0961c87884a04517b65c0acc6aedeeae2d0c8</id>
<content type='text'>
When run_command() was asked to run a non-existant command, its behavior
varied depending on the platform:

  - on POSIX systems, we would fork, and then after the execvp call
    failed, we could call die(), which prints a message to stderr and
    exits with code 128.

  - on Windows, we do a PATH lookup, realize the program isn't there, and
    then return ERR_RUN_COMMAND_FORK

The goal of this patch is to make it clear to callers that the specific
error was a missing command. To do this, we will return the error code
ERR_RUN_COMMAND_EXEC, which is already defined in run-command.h, checked
for in several places, but never actually gets set.

The new behavior is:

  - on POSIX systems, we exit the forked process with code 127 (the same
    as the shell uses to report missing commands). The parent process
    recognizes this code and returns an EXEC error. The stderr message is
    silenced, since the caller may be speculatively trying to run a
    command. Instead, we use trace_printf so that somebody interested in
    debugging can see the error that occured.

  - on Windows, we check errno, which is already set correctly by
    mingw_spawnvpe, and report an EXEC error instead of a FORK error

Thus it is safe to speculatively run a command:

  int r = run_command_v_opt(argv, 0);
  if (r == -ERR_RUN_COMMAND_EXEC)
	  /* oops, it wasn't found; try something else */
  else
	  /* we failed for some other reason, error is in r */

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_hook(): allow more than 9 hook arguments</title>
<updated>2009-01-18T01:57:15Z</updated>
<author>
<name>Stephan Beyer</name>
<email>s-beyer@gmx.net</email>
</author>
<published>2009-01-17T03:02:55Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=14e6298f1215da503f0f65b63e13d674dd781868'/>
<id>urn:sha1:14e6298f1215da503f0f65b63e13d674dd781868</id>
<content type='text'>
This is done using the ALLOC_GROW macro.

Signed-off-by: Stephan Beyer &lt;s-beyer@gmx.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run_hook(): check the executability of the hook before filling argv</title>
<updated>2009-01-18T01:16:44Z</updated>
<author>
<name>Stephan Beyer</name>
<email>s-beyer@gmx.net</email>
</author>
<published>2009-01-16T19:10:01Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=cf94ca8ea98373d6f5e9caaa764eca89b20bfb63'/>
<id>urn:sha1:cf94ca8ea98373d6f5e9caaa764eca89b20bfb63</id>
<content type='text'>
Signed-off-by: Stephan Beyer &lt;s-beyer@gmx.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Move run_hook() from builtin-commit.c into run-command.c (libgit)</title>
<updated>2009-01-18T01:16:24Z</updated>
<author>
<name>Stephan Beyer</name>
<email>s-beyer@gmx.net</email>
</author>
<published>2009-01-16T19:09:59Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ae98a0089ff7f7641ed15ddd595797de56eb49f1'/>
<id>urn:sha1:ae98a0089ff7f7641ed15ddd595797de56eb49f1</id>
<content type='text'>
A function that runs a hook is used in several Git commands.
builtin-commit.c has the one that is most general for cases without
piping. The one in builtin-gc.c prints some useful warnings.
This patch moves a merged version of these variants into libgit and
lets the other builtins use this libified run_hook().

The run_hook() function used in receive-pack.c feeds the standard
input of the pre-receive or post-receive hooks. This function is
renamed to run_receive_hook() because the libified run_hook() cannot
handle this.

Mentored-by: Daniel Barkalow &lt;barkalow@iabervon.org&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Stephan Beyer &lt;s-beyer@gmx.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command.c: remove run_command_v_opt_cd()</title>
<updated>2008-10-03T01:02:44Z</updated>
<author>
<name>Nanako Shiraishi</name>
<email>nanako3@lavabit.com</email>
</author>
<published>2008-10-02T10:14:25Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7996ff335e675b229398974f6cbf459843c9bf6d'/>
<id>urn:sha1:7996ff335e675b229398974f6cbf459843c9bf6d</id>
<content type='text'>
This function is not used anywhere.

Johannes Sixt &lt;johannes.sixt@telecom.at&gt;:
&gt; Future callers can use run_command_v_opt_cd_env() instead.

Signed-off-by: Nanako Shiraishi &lt;nanako3@lavabit.com&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/pager-swap'</title>
<updated>2008-08-20T04:42:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-08-20T04:42:55Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=0208c9611ab4e82b09feba857c4f9bc8e02a6d9d'/>
<id>urn:sha1:0208c9611ab4e82b09feba857c4f9bc8e02a6d9d</id>
<content type='text'>
* jk/pager-swap:
  spawn pager via run_command interface
  run-command: add pre-exec callback
</content>
</entry>
<entry>
<title>Add output flushing before fork()</title>
<updated>2008-08-05T04:46:42Z</updated>
<author>
<name>Anders Melchiorsen</name>
<email>mail@cup.kalibalik.dk</email>
</author>
<published>2008-08-04T10:18:40Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7d0b18a4da1be9e738293cc13812757ca47ed109'/>
<id>urn:sha1:7d0b18a4da1be9e738293cc13812757ca47ed109</id>
<content type='text'>
This adds fflush(NULL) before fork() in start_command(), to keep
the generic interface safe.

A remaining use of fork() with no flushing is in a comment in
show_tree(). Rewrite that comment to use start_command().

Signed-off-by: Anders Melchiorsen &lt;mail@cup.kalibalik.dk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Flush output in start_async</title>
<updated>2008-08-04T00:55:40Z</updated>
<author>
<name>Anders Melchiorsen</name>
<email>mail@cup.kalibalik.dk</email>
</author>
<published>2008-08-04T00:30:03Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=2c3766f06adf0ba226a592939971f8ef587e54c1'/>
<id>urn:sha1:2c3766f06adf0ba226a592939971f8ef587e54c1</id>
<content type='text'>
This prevents double output in case stdout is redirected.

Signed-off-by: Anders Melchiorsen &lt;mail@cup.kalibalik.dk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command (Windows): Run dashless "git &lt;cmd&gt;"</title>
<updated>2008-07-29T06:02:11Z</updated>
<author>
<name>Steffen Prohaska</name>
<email>prohaska@zib.de</email>
</author>
<published>2008-07-28T05:50:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=108ac313f73499572c69b1b80514661b22a2d62e'/>
<id>urn:sha1:108ac313f73499572c69b1b80514661b22a2d62e</id>
<content type='text'>
We prefer running the dashless form, and POSIX side already does so; we
should use it in MinGW's start_command(), too.

Signed-off-by: Steffen Prohaska &lt;prohaska@zib.de&gt;
Acked-by: Johannes Sixt &lt;johannes.sixt@telecom.at&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
