summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-11-21 23:14:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-11-21 23:14:38 (GMT)
commit473c6224c6e46b68c4765d56628a85cea0ee9985 (patch)
tree4d73a452c41644927eee2e603bf50df850c81d96 /t/t4014-format-patch.sh
parentfaefdd61ec7c7f6f3c8c9907891465ac9a2a1475 (diff)
parent3baf58bfb4bcfe201970abeffa8e1396d2324250 (diff)
downloadgit-473c6224c6e46b68c4765d56628a85cea0ee9985.zip
git-473c6224c6e46b68c4765d56628a85cea0ee9985.tar.gz
git-473c6224c6e46b68c4765d56628a85cea0ee9985.tar.bz2
Merge branch 'jc/format-patch-name-max'
The maximum length of output filenames "git format-patch" creates has become configurable (used to be capped at 64). * jc/format-patch-name-max: format-patch: make output filename configurable
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 42588bf..c5e5e0d 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -313,6 +313,60 @@ test_expect_success 'multiple files' '
ls patches/0001-Side-changes-1.patch patches/0002-Side-changes-2.patch patches/0003-Side-changes-3-with-n-backslash-n-in-it.patch
'
+test_expect_success 'filename length limit' '
+ test_when_finished "rm -f 000*" &&
+ rm -rf 000[1-9]-*.patch &&
+ for len in 15 25 35
+ do
+ git format-patch --filename-max-length=$len -3 side &&
+ max=$(
+ for patch in 000[1-9]-*.patch
+ do
+ echo "$patch" | wc -c
+ done |
+ sort -nr |
+ head -n 1
+ ) &&
+ test $max -le $len || return 1
+ done
+'
+
+test_expect_success 'filename length limit from config' '
+ test_when_finished "rm -f 000*" &&
+ rm -rf 000[1-9]-*.patch &&
+ for len in 15 25 35
+ do
+ git -c format.filenameMaxLength=$len format-patch -3 side &&
+ max=$(
+ for patch in 000[1-9]-*.patch
+ do
+ echo "$patch" | wc -c
+ done |
+ sort -nr |
+ head -n 1
+ ) &&
+ test $max -le $len || return 1
+ done
+'
+
+test_expect_success 'filename limit applies only to basename' '
+ test_when_finished "rm -rf patches/" &&
+ rm -rf patches/ &&
+ for len in 15 25 35
+ do
+ git format-patch -o patches --filename-max-length=$len -3 side &&
+ max=$(
+ for patch in patches/000[1-9]-*.patch
+ do
+ echo "${patch#patches/}" | wc -c
+ done |
+ sort -nr |
+ head -n 1
+ ) &&
+ test $max -le $len || return 1
+ done
+'
+
test_expect_success 'reroll count' '
rm -fr patches &&
git format-patch -o patches --cover-letter --reroll-count 4 master..side >list &&