summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@linaro.org>2021-03-23 17:33:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-23 22:02:52 (GMT)
commitc8243933c74e0bebcc617f750ae3990ecca47759 (patch)
treedff66299172f89b05e54680fd18c34d05bd79076 /t/t9001-send-email.sh
parent142430338477d9d1bb25be66267225fb58498d92 (diff)
downloadgit-c8243933c74e0bebcc617f750ae3990ecca47759.zip
git-c8243933c74e0bebcc617f750ae3990ecca47759.tar.gz
git-c8243933c74e0bebcc617f750ae3990ecca47759.tar.bz2
git-send-email: Respect core.hooksPath setting
get-send-email currently makes the assumption that the 'sendemail-validate' hook exists inside of the repository. Since the introduction of 'core.hooksPath' configuration option in 867ad08a261 (hooks: allow customizing where the hook directory is, 2016-05-04), this is no longer true. Instead of assuming a hardcoded repo relative path, query git for the actual path of the hooks directory. Signed-off-by: Robert Foss <robert.foss@linaro.org> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4eee9c3..1a1caf8 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -513,6 +513,38 @@ do
done
+test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
+ clean_fake_sendmail &&
+ mkdir my-hooks &&
+ test_when_finished "rm my-hooks.ran" &&
+ write_script my-hooks/sendemail-validate <<-\EOF &&
+ >my-hooks.ran
+ exit 1
+ EOF
+ test_config core.hooksPath "my-hooks" &&
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ --validate \
+ longline.patch 2>err &&
+ test_path_is_file my-hooks.ran &&
+ grep "rejected by sendemail-validate" err
+'
+
+test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
+ test_config core.hooksPath "$(pwd)/my-hooks" &&
+ test_when_finished "rm my-hooks.ran" &&
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ --validate \
+ longline.patch 2>err &&
+ test_path_is_file my-hooks.ran &&
+ grep "rejected by sendemail-validate" err
+'
+
for enc in 7bit 8bit quoted-printable base64
do
test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '