Staging
v0.5.1
https://github.com/git/git
Revision 4ecbc178704ca6c1027a38483e98f5fe493b1322 authored by Jeff King on 09 July 2009, 06:37:35 UTC, committed by Junio C Hamano on 09 July 2009, 08:19:51 UTC
When a git command executes a subcommand, it uses the "git
foo" form, which relies on finding "git" in the PATH.
Normally this should not be a problem, since the same "git"
that was used to invoke git in the first place will be
found.  And if somebody invokes a "git" outside of the PATH
(e.g., by giving its absolute path), this case is already
covered: we put that absolute path onto the front of PATH.

However, if one is using "sudo", then sudo will execute the
"git" from the PATH, but pass along a restricted PATH that
may not contain the original "git" directory. In this case,
executing a subcommand will fail.

To solve this, we put the "git" wrapper itself into the
execdir; this directory is prepended to the PATH when git
starts, so the wrapper will always be found.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3125be1
Raw File
Tip revision: 4ecbc178704ca6c1027a38483e98f5fe493b1322 authored by Jeff King on 09 July 2009, 06:37:35 UTC
Makefile: install 'git' in execdir
Tip revision: 4ecbc17
test-match-trees.c
#include "cache.h"
#include "tree.h"

int main(int ac, char **av)
{
	unsigned char hash1[20], hash2[20], shifted[20];
	struct tree *one, *two;

	if (get_sha1(av[1], hash1))
		die("cannot parse %s as an object name", av[1]);
	if (get_sha1(av[2], hash2))
		die("cannot parse %s as an object name", av[2]);
	one = parse_tree_indirect(hash1);
	if (!one)
		die("not a treeish %s", av[1]);
	two = parse_tree_indirect(hash2);
	if (!two)
		die("not a treeish %s", av[2]);

	shift_tree(one->object.sha1, two->object.sha1, shifted, -1);
	printf("shifted: %s\n", sha1_to_hex(shifted));

	exit(0);
}
back to top