<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/run-command.c, branch v2.17.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.17.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.17.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-01-19T18:49:20Z</updated>
<entry>
<title>run-command.c: print new cwd in trace_run_command()</title>
<updated>2018-01-19T18:49:20Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-18T09:45:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=090a09272ac3bead828519b66eb62d53b53ecf7d'/>
<id>urn:sha1:090a09272ac3bead828519b66eb62d53b53ecf7d</id>
<content type='text'>
If a command sets a new env variable GIT_DIR=.git, we need more context
to know where that '.git' is related to.

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>run-command.c: print env vars in trace_run_command()</title>
<updated>2018-01-19T18:49:20Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-18T09:45:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c61a975df1d3d5e448622f951e6dd584ee21ebf3'/>
<id>urn:sha1:c61a975df1d3d5e448622f951e6dd584ee21ebf3</id>
<content type='text'>
Occasionally submodule code could execute new commands with GIT_DIR set
to some submodule. GIT_TRACE prints just the command line which makes it
hard to tell that it's not really executed on this repository.

Print the env delta (compared to parent environment) in this case.

Helped-by: Junio C Hamano &lt;gitster@pobox.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>run-command.c: print program 'git' when tracing git_cmd mode</title>
<updated>2018-01-19T18:49:20Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-18T09:45:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=21dfc5e08fec74ded0ab4206bca0927a38feb882'/>
<id>urn:sha1:21dfc5e08fec74ded0ab4206bca0927a38feb882</id>
<content type='text'>
We normally print full command line, including the program and its
argument. When git_cmd is set, we have a special code path to run the
right "git" program and child_process.argv[0] will not contain the
program name anymore. As a result, we print just the command
arguments.

I thought it was a regression when the code was refactored and git_cmd
added, but apparently it's not. git_cmd mode was introduced before
tracing was added in 8852f5d704 (run_command(): respect GIT_TRACE -
2008-07-07) so it's more like an oversight in 8852f5d704.

Fix it, print the program name "git" in git_cmd mode. It's nice to have
now. But it will be more important later when we start to print env
variables too, in shell syntax. The lack of a program name would look
confusing then.

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>run-command.c: introduce trace_run_command()</title>
<updated>2018-01-19T18:49:20Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-18T09:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e73dd78699c4a0a84960c3519e6bdc6e49009740'/>
<id>urn:sha1:e73dd78699c4a0a84960c3519e6bdc6e49009740</id>
<content type='text'>
This is the same as the old code that uses trace_argv_printf() in
run-command.c. This function will be improved in later patches to
print more information from struct child_process.

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>run-command: add hint when a hook is ignored</title>
<updated>2017-10-10T04:21:46Z</updated>
<author>
<name>Damien Marié</name>
<email>damien@dam.io</email>
</author>
<published>2017-10-06T08:07:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f805a00a396ee91599902cebe55620b2a4c813b9'/>
<id>urn:sha1:f805a00a396ee91599902cebe55620b2a4c813b9</id>
<content type='text'>
When an hook is present but the file is not set as executable then git will
ignore the hook.
For now this is silent which can be confusing.

This commit adds this warning to improve the situation:

  hint: The 'pre-commit' hook was ignored because it's not set as executable.
  hint: You can disable this warning with `git config advice.ignoredHook false`

To allow the old use-case of enabling/disabling hooks via the executable flag a
new setting is introduced: advice.ignoredHook.

Signed-off-by: Damien Marié &lt;damien@dam.io&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command: use ALLOC_ARRAY</title>
<updated>2017-10-02T23:42:57Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-10-01T15:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0e187d758cd4ad0f929b90b04adee7ec19f7fc93'/>
<id>urn:sha1:0e187d758cd4ad0f929b90b04adee7ec19f7fc93</id>
<content type='text'>
Use the macro ALLOC_ARRAY to allocate an array.  This is shorter and
easier, as it automatically infers the size of elements.

Patch generated with Coccinelle and contrib/coccinelle/array.cocci.

Signeg-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/run-process-parallel-api-fix' into maint</title>
<updated>2017-08-23T21:33:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-23T21:33:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=08692770339ff551485812d34c54fa6d290694f3'/>
<id>urn:sha1:08692770339ff551485812d34c54fa6d290694f3</id>
<content type='text'>
API fix.

* js/run-process-parallel-api-fix:
  run_processes_parallel: change confusing task_cb convention
</content>
</entry>
<entry>
<title>run_processes_parallel: change confusing task_cb convention</title>
<updated>2017-07-21T18:58:46Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2017-07-19T14:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c1e860f1dcd29495f98fc60d68f75151196335e6'/>
<id>urn:sha1:c1e860f1dcd29495f98fc60d68f75151196335e6</id>
<content type='text'>
By declaring the task_cb parameter of type `void **`, the signature of
the get_next_task method suggests that the "task-specific cookie" can be
defined in that method, and the signatures of the start_failure and of
the task_finished methods declare that parameter of type `void *`,
suggesting that those methods are mere users of said cookie.

That convention makes a total lot of sense, because the tasks are pretty
much dead when one of the latter two methods is called: there would be
little use to reset that cookie at that point because nobody would be
able to see the change afterwards.

However, this is not what the code actually does. For all three methods,
it passes the *address* of pp-&gt;children[i].data.

As reasoned above, this behavior makes no sense. So let's change the
implementation to adhere to the convention suggested by the signatures.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Acked-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command: restrict PATH search to executable files</title>
<updated>2017-04-26T06:17:36Z</updated>
<author>
<name>Brandon Williams</name>
<email>bmwill@google.com</email>
</author>
<published>2017-04-25T23:47:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=940283101ce87250cf31a592730386f5061e1286'/>
<id>urn:sha1:940283101ce87250cf31a592730386f5061e1286</id>
<content type='text'>
In some situations run-command will incorrectly try (and fail) to
execute a directory instead of an executable file.  This was observed by
having a directory called "ssh" in $PATH before the real ssh and trying
to use ssh protoccol, reslting in the following:

	$ git ls-remote ssh://url
	fatal: cannot exec 'ssh': Permission denied

It ends up being worse and run-command will even try to execute a
non-executable file if it preceeds the executable version of a file on
the PATH.  For example, if PATH=~/bin1:~/bin2:~/bin3 and there exists a
directory 'git-hello' in 'bin1', a non-executable file 'git-hello' in
bin2 and an executable file 'git-hello' (which prints "Hello World!") in
bin3 the following will occur:

	$ git hello
	fatal: cannot exec 'git-hello': Permission denied

This is due to only checking 'access()' when locating an executable in
PATH, which doesn't distinguish between files and directories.  Instead
use 'is_executable()' which check that the path is to a regular,
executable file.  Now run-command won't try to execute the directory or
non-executable file 'git-hello':

	$ git hello
	Hello World!

which matches what execvp(3) would have done when asked to execute
git-hello with such a $PATH.

Reported-by: Brian Hatfield &lt;bhatfield@google.com&gt;
Signed-off-by: Brandon Williams &lt;bmwill@google.com&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>run-command: expose is_executable function</title>
<updated>2017-04-26T01:45:29Z</updated>
<author>
<name>Brandon Williams</name>
<email>bmwill@google.com</email>
</author>
<published>2017-04-25T23:46:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=38124a40e480c1717326b7bc27bcbca758de908e'/>
<id>urn:sha1:38124a40e480c1717326b7bc27bcbca758de908e</id>
<content type='text'>
Move the logic for 'is_executable()' from help.c to run_command.c and
expose it so that callers from outside help.c can access the function.
This is to enable run-command to be able to query if a file is
executable in a future patch.

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