зеркало из https://github.com/microsoft/git.git
Pass PID of git process to hooks.
Signed-off-by: Alejandro Pauly <alpauly@microsoft.com>
This commit is contained in:
Родитель
b2cac1b72a
Коммит
50188158b8
1
git.c
1
git.c
|
@ -449,6 +449,7 @@ static int run_pre_command_hook(const char **argv)
|
|||
|
||||
/* call the hook proc */
|
||||
strvec_pushv(&sargv, argv);
|
||||
strvec_pushf(&sargv, "--git-pid=%"PRIuMAX, (uintmax_t)getpid());
|
||||
strvec_pushv(&opt.args, sargv.v);
|
||||
ret = run_hooks_opt("pre-command", &opt);
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ test_expect_success 'with no hook' '
|
|||
test_expect_success 'with succeeding hook' '
|
||||
mkdir -p .git/hooks &&
|
||||
write_script .git/hooks/pre-command <<-EOF &&
|
||||
echo "\$*" >\$(git rev-parse --git-dir)/pre-command.out
|
||||
echo "\$*" | sed "s/ --git-pid=[0-9]*//" \
|
||||
>\$(git rev-parse --git-dir)/pre-command.out
|
||||
EOF
|
||||
echo "second" >> file &&
|
||||
git add file &&
|
||||
|
|
|
@ -13,7 +13,8 @@ test_expect_success 'with no hook' '
|
|||
test_expect_success 'with succeeding hook' '
|
||||
mkdir -p .git/hooks &&
|
||||
write_script .git/hooks/post-command <<-EOF &&
|
||||
echo "\$*" >\$(git rev-parse --git-dir)/post-command.out
|
||||
echo "\$*" | sed "s/ --git-pid=[0-9]*//" \
|
||||
>\$(git rev-parse --git-dir)/post-command.out
|
||||
EOF
|
||||
echo "second" >> file &&
|
||||
git add file &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче