aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-09-28 17:29:16 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-07 10:05:48 -0700
commitccfcaf399ffcc91553395a8de8e833e7685e7cc2 (patch)
tree42f7409a32b8414fbd9f1923ad62115ef7cee3bc /t
parentconfig: values of pathname type can be prefixed with :(optional) (diff)
downloadgit-ccfcaf399ffcc91553395a8de8e833e7685e7cc2.tar.gz
git-ccfcaf399ffcc91553395a8de8e833e7685e7cc2.zip
parseopt: values of pathname type can be prefixed with :(optional)
In the previous step, we introduced an optional filename that can be given to a configuration variable, and nullify the fact that such a configuration setting even existed if the named path is missing or empty. Let's do the same for command line options that name a pathname. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7500-commit-template-squash-signoff.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh
index a85229e556..1935171d68 100755
--- a/t/t7500-commit-template-squash-signoff.sh
+++ b/t/t7500-commit-template-squash-signoff.sh
@@ -37,6 +37,16 @@ test_expect_success 'nonexistent template file should return error' '
)
'
+test_expect_success 'nonexistent optional template file on command line' '
+ echo changes >> foo &&
+ git add foo &&
+ (
+ GIT_EDITOR="echo hello >\"\$1\"" &&
+ export GIT_EDITOR &&
+ git commit --template ":(optional)$PWD/notexist"
+ )
+'
+
test_expect_success 'nonexistent template file in config should return error' '
test_config commit.template "$PWD"/notexist &&
(