aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-24 15:46:39 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-24 15:46:39 -0800
commit54f7817456940bb1f72cb747328e5fde75307dc3 (patch)
treeb046035205941760cf53b526320fc146fa161359 /t
parentdebbc87557487aa9a8ed8a35367d17f8b4081c76 (diff)
parent42ed0468663dd493c0a0e00edc83b668369157d6 (diff)
downloadgit-54f7817456940bb1f72cb747328e5fde75307dc3.tar.xz
Merge branch 'jk/attr-macroexpand-wo-recursion'
The code to expand attribute macros has been rewritten to avoid recursion to avoid running out of stack space in an uncontrolled way. * jk/attr-macroexpand-wo-recursion: attr: avoid recursion when expanding attribute macros
Diffstat (limited to 't')
-rwxr-xr-xt/t0003-attributes.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index 3c98b622f2..582e207aa1 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -664,4 +664,24 @@ test_expect_success 'user defined builtin_objectmode values are ignored' '
test_cmp expect err
'
+test_expect_success ULIMIT_STACK_SIZE 'deep macro recursion' '
+ n=3000 &&
+ {
+ i=0 &&
+ while test $i -lt $n; do
+ echo "[attr]a$i a$((i+1))" &&
+ i=$((i+1)) ||
+ return 1
+ done &&
+ echo "[attr]a$n -text" &&
+ echo "file a0"
+ } >.gitattributes &&
+ {
+ echo "file: text: unset" &&
+ test_seq -f "file: a%d: set" 0 $n
+ } >expect &&
+ run_with_limited_stack git check-attr -a file >actual &&
+ test_cmp expect actual
+'
+
test_done