aboutsummaryrefslogtreecommitdiffstats
path: root/t/t6406-merge-attr.sh
diff options
context:
space:
mode:
authorUsman Akinyemi <usmanakinyemi202@gmail.com>2024-10-24 00:24:57 +0000
committerTaylor Blau <me@ttaylorr.com>2024-10-24 14:03:44 -0400
commite36f009e69b68a82f216f9633f99198421a67f12 (patch)
treea933bdc9a0c9ac0186da758f2a0e6d52982ed36d /t/t6406-merge-attr.sh
parentcc4023477f3c958b77c64b7f36f91b4f9d7c5a58 (diff)
downloadgit-e36f009e69b68a82f216f9633f99198421a67f12.tar.gz
merge: replace atoi() with strtol_i() for marker size validation
Replace atoi() with strtol_i() for parsing conflict-marker-size to improve error handling. Invalid values, such as those containing letters now trigger a clear error message. Update the test to verify invalid input handling. Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 't/t6406-merge-attr.sh')
-rwxr-xr-xt/t6406-merge-attr.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t6406-merge-attr.sh b/t/t6406-merge-attr.sh
index 9bf9524934..2dfc9a873d 100755
--- a/t/t6406-merge-attr.sh
+++ b/t/t6406-merge-attr.sh
@@ -118,6 +118,14 @@ test_expect_success 'retry the merge with longer context' '
grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual
'
+test_expect_success 'invalid conflict-marker-size 3a' '
+ cp .gitattributes .gitattributes.bak &&
+ echo "text conflict-marker-size=3a" >>.gitattributes &&
+ test_when_finished "mv .gitattributes.bak .gitattributes" &&
+ git checkout -m text 2>err &&
+ test_grep "warning: invalid marker-size ${SQ}3a${SQ}, expecting an integer" err
+'
+
test_expect_success 'custom merge backend' '
echo "* merge=union" >.gitattributes &&