Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 0fce85d

Browse files
committed
Avoid bash-ism
The construct ${varname:start:end} can only be interpreted by Bash; In Git, we strive for POSIX compatibility, though, therefore we need to change the code to avoid Bash-isms. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent c9e6412 commit 0fce85d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: t/t7410-submodule-long-path.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ TEST_NO_CREATE_REPO=1
1414
# cloning a submodule calls is_git_directory("$path/../.git/modules/$path"),
1515
# which effectively limits the maximum length to PATH_MAX / 2 minus some
1616
# overhead; start with 3 * 36 = 108 chars (test 2 fails if >= 110)
17-
longpath=0123456789abcdefghijklmnopqrstuvwxyz
18-
longpath=$longpath$longpath$longpath
17+
longpath36=0123456789abcdefghijklmnopqrstuvwxyz
18+
longpath180=$longpath36$longpath36$longpath36$longpath36$longpath36
1919

2020
# the git database must fit within PATH_MAX, which limits the submodule name
2121
# to PATH_MAX - len(pwd) - ~90 (= len("/objects//") + 40-byte sha1 + some
2222
# overhead from the test case)
2323
pwd=$(pwd)
24-
longpath=${longpath:0:170-${#pwd}}
24+
pwdlen=$(echo "$pwd" | wc -c)
25+
longpath=$(echo $longpath180 | cut -c 1-$((170-$pwdlen)))
2526

2627
test_expect_success 'submodule with a long path' '
2728
git init --bare remote &&

0 commit comments

Comments
 (0)