my $exit_code = $? >> 8;
return unless $signalled or $exit_code;
- return sprintf(__("failed to run command %s, died with code %d"),
- "@$args", $exit_code);
+ return sprintf(__("fatal: command '%s' died with exit code %d"),
+ $args->[0], $exit_code);
}
sub system_or_die {
}
if ($hook_error) {
die sprintf(__("fatal: %s: rejected by sendemail-validate hook\n" .
- "warning: no patches were sent\n"), $fn);
+ "%s\n" .
+ "warning: no patches were sent\n"), $fn, $hook_error);
}
}
or die sprintf(__("unable to open %s: %s\n"), $fn, $!);
while (my $line = <$fh>) {
if (length($line) > 998) {
- die sprintf(__("fatal: %s: %d: patch contains a line longer than 998 characters\n" .
- "warning: no patches were sent\n"),
- $fn, $.);
+ die sprintf(__("fatal: %s:%d is longer than 998 characters\n" .
+ "warning: no patches were sent\n"), $fn, $.);
}
}
}
z512=$z64$z64$z64$z64$z64$z64$z64$z64 &&
clean_fake_sendmail &&
cp $patches longline.patch &&
- echo $z512$z512 >>longline.patch &&
+ cat >>longline.patch <<-EOF &&
+ $z512$z512
+ not a long line
+ $z512$z512
+ EOF
test_must_fail git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
$patches longline.patch \
2>actual &&
cat >expect <<-\EOF &&
- fatal: longline.patch: 35: patch contains a line longer than 998 characters
+ fatal: longline.patch:35 is longer than 998 characters
warning: no patches were sent
EOF
test_cmp expect actual
--validate \
longline.patch 2>actual &&
test_path_is_file my-hooks.ran &&
- cat >expect <<-\EOF &&
+ cat >expect <<-EOF &&
fatal: longline.patch: rejected by sendemail-validate hook
+ fatal: command '"'"'$(pwd)/my-hooks/sendemail-validate'"'"' died with exit code 1
warning: no patches were sent
EOF
test_cmp expect actual
'
test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
- test_config core.hooksPath "$(pwd)/my-hooks" &&
+ hooks_path="$(pwd)/my-hooks" &&
+ test_config core.hooksPath "$hooks_path" &&
test_when_finished "rm my-hooks.ran" &&
test_must_fail git send-email \
--from="Example <nobody@example.com>" \
--validate \
longline.patch 2>actual &&
test_path_is_file my-hooks.ran &&
- cat >expect <<-\EOF &&
+ cat >expect <<-EOF &&
fatal: longline.patch: rejected by sendemail-validate hook
+ fatal: command '"'"'$hooks_path/sendemail-validate'"'"' died with exit code 1
warning: no patches were sent
EOF
test_cmp expect actual