summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-24 13:48:04 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-24 13:48:04 -0700
commit385772e1834c394dede867dee05164a67b7b34f3 (patch)
tree555714022c200190f3c482f3171026c562c594f1
parent411903ce4cf2c5c64e2afb1063665edf599414b7 (diff)
parent91e6a645e75026a42977e37f24fca3f1fe54de58 (diff)
Merge branch 'js/t7500-pwd-windows-fix'
Test fix. * js/t7500-pwd-windows-fix: t7500: fix tests with absolute path following ":(optional)" on Windows
-rwxr-xr-xt/t7500-commit-template-squash-signoff.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh
index 1935171d68..66aff8e097 100755
--- a/t/t7500-commit-template-squash-signoff.sh
+++ b/t/t7500-commit-template-squash-signoff.sh
@@ -33,7 +33,7 @@ test_expect_success 'nonexistent template file should return error' '
(
GIT_EDITOR="echo hello >" &&
export GIT_EDITOR &&
- test_must_fail git commit --template "$PWD"/notexist
+ test_must_fail git commit --template "$(pwd)"/notexist
)
'
@@ -43,12 +43,12 @@ test_expect_success 'nonexistent optional template file on command line' '
(
GIT_EDITOR="echo hello >\"\$1\"" &&
export GIT_EDITOR &&
- git commit --template ":(optional)$PWD/notexist"
+ git commit --template ":(optional)$(pwd)/notexist"
)
'
test_expect_success 'nonexistent template file in config should return error' '
- test_config commit.template "$PWD"/notexist &&
+ test_config commit.template "$(pwd)"/notexist &&
(
GIT_EDITOR="echo hello >" &&
export GIT_EDITOR &&
@@ -57,7 +57,7 @@ test_expect_success 'nonexistent template file in config should return error' '
'
test_expect_success 'nonexistent optional template file in config' '
- test_config commit.template ":(optional)$PWD"/notexist &&
+ test_config commit.template ":(optional)$(pwd)"/notexist &&
GIT_EDITOR="echo hello >" git commit --allow-empty &&
git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
echo hello >expect &&
@@ -65,7 +65,7 @@ test_expect_success 'nonexistent optional template file in config' '
'
# From now on we'll use a template file that exists.
-TEMPLATE="$PWD"/template
+TEMPLATE="$(pwd)"/template
test_expect_success 'unedited template should not commit' '
echo "template line" >"$TEMPLATE" &&
@@ -99,6 +99,15 @@ test_expect_success 'adding real content to a template should commit' '
commit_msg_is "template linecommit message"
'
+test_expect_success 'existent template marked optional should commit' '
+ echo "existent template" >"$TEMPLATE" &&
+ (
+ test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
+ git commit --allow-empty --template ":(optional)$TEMPLATE"
+ ) &&
+ commit_msg_is "existent templatecommit message"
+'
+
test_expect_success '-t option should be short for --template' '
echo "short template" > "$TEMPLATE" &&
echo "new content" >> foo &&