Merge branch 'jk/use-write-script-more'
Code clean-up. * jk/use-write-script-more: t3404: use write_script t1020: do not overuse printf and use write_script t5532: use write_script
This commit is contained in:
commit
2416803b6c
@ -141,13 +141,13 @@ test_expect_success 'GIT_PREFIX for !alias' '
|
|||||||
test_expect_success 'GIT_PREFIX for built-ins' '
|
test_expect_success 'GIT_PREFIX for built-ins' '
|
||||||
# Use GIT_EXTERNAL_DIFF to test that the "diff" built-in
|
# Use GIT_EXTERNAL_DIFF to test that the "diff" built-in
|
||||||
# receives the GIT_PREFIX variable.
|
# receives the GIT_PREFIX variable.
|
||||||
printf "dir/" >expect &&
|
echo "dir/" >expect &&
|
||||||
printf "#!/bin/sh\n" >diff &&
|
write_script diff <<-\EOF &&
|
||||||
printf "printf \"\$GIT_PREFIX\"" >>diff &&
|
printf "%s\n" "$GIT_PREFIX"
|
||||||
chmod +x diff &&
|
EOF
|
||||||
(
|
(
|
||||||
cd dir &&
|
cd dir &&
|
||||||
printf "change" >two &&
|
echo "change" >two &&
|
||||||
GIT_EXTERNAL_DIFF=./diff git diff >../actual
|
GIT_EXTERNAL_DIFF=./diff git diff >../actual
|
||||||
git checkout -- two
|
git checkout -- two
|
||||||
) &&
|
) &&
|
||||||
|
@ -555,10 +555,9 @@ test_expect_success 'rebase a detached HEAD' '
|
|||||||
test_expect_success 'rebase a commit violating pre-commit' '
|
test_expect_success 'rebase a commit violating pre-commit' '
|
||||||
|
|
||||||
mkdir -p .git/hooks &&
|
mkdir -p .git/hooks &&
|
||||||
PRE_COMMIT=.git/hooks/pre-commit &&
|
write_script .git/hooks/pre-commit <<-\EOF &&
|
||||||
echo "#!/bin/sh" > $PRE_COMMIT &&
|
test -z "$(git diff --cached --check)"
|
||||||
echo "test -z \"\$(git diff --cached --check)\"" >> $PRE_COMMIT &&
|
EOF
|
||||||
chmod a+x $PRE_COMMIT &&
|
|
||||||
echo "monde! " >> file1 &&
|
echo "monde! " >> file1 &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
test_must_fail git commit -m doesnt-verify file1 &&
|
test_must_fail git commit -m doesnt-verify file1 &&
|
||||||
|
@ -12,10 +12,8 @@ test_expect_success 'setup remote repo' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >proxy <<'EOF'
|
test_expect_success 'setup proxy script' '
|
||||||
#!/bin/sh
|
write_script proxy-get-cmd "$PERL_PATH" <<-\EOF &&
|
||||||
echo >&2 "proxying for $*"
|
|
||||||
cmd=$("$PERL_PATH" -e '
|
|
||||||
read(STDIN, $buf, 4);
|
read(STDIN, $buf, 4);
|
||||||
my $n = hex($buf) - 4;
|
my $n = hex($buf) - 4;
|
||||||
read(STDIN, $buf, $n);
|
read(STDIN, $buf, $n);
|
||||||
@ -23,11 +21,16 @@ cmd=$("$PERL_PATH" -e '
|
|||||||
# drop absolute-path on repo name
|
# drop absolute-path on repo name
|
||||||
$cmd =~ s{ /}{ };
|
$cmd =~ s{ /}{ };
|
||||||
print $cmd;
|
print $cmd;
|
||||||
')
|
EOF
|
||||||
echo >&2 "Running '$cmd'"
|
|
||||||
|
write_script proxy <<-\EOF
|
||||||
|
echo >&2 "proxying for $*"
|
||||||
|
cmd=$(./proxy-get-cmd)
|
||||||
|
echo >&2 "Running $cmd"
|
||||||
exec $cmd
|
exec $cmd
|
||||||
EOF
|
EOF
|
||||||
chmod +x proxy
|
'
|
||||||
|
|
||||||
test_expect_success 'setup local repo' '
|
test_expect_success 'setup local repo' '
|
||||||
git remote add fake git://example.com/remote &&
|
git remote add fake git://example.com/remote &&
|
||||||
git config core.gitproxy ./proxy
|
git config core.gitproxy ./proxy
|
||||||
|
Loading…
Reference in New Issue
Block a user