From a81f1378ed58a4097ee1ced14586b946fe320167 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 27 Jan 2014 07:55:44 +0000 Subject: [PATCH] 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 --- t/t7410-submodule-long-path.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/t7410-submodule-long-path.sh b/t/t7410-submodule-long-path.sh index 06fed6feab48c6..59b3d347db528f 100755 --- a/t/t7410-submodule-long-path.sh +++ b/t/t7410-submodule-long-path.sh @@ -14,14 +14,15 @@ TEST_NO_CREATE_REPO=1 # cloning a submodule calls is_git_directory("$path/../.git/modules/$path"), # which effectively limits the maximum length to PATH_MAX / 2 minus some # overhead; start with 3 * 36 = 108 chars (test 2 fails if >= 110) -longpath=0123456789abcdefghijklmnopqrstuvwxyz -longpath=$longpath$longpath$longpath +longpath36=0123456789abcdefghijklmnopqrstuvwxyz +longpath180=$longpath36$longpath36$longpath36$longpath36$longpath36 # the git database must fit within PATH_MAX, which limits the submodule name # to PATH_MAX - len(pwd) - ~90 (= len("/objects//") + 40-byte sha1 + some # overhead from the test case) pwd=$(pwd) -longpath=${longpath:0:170-${#pwd}} +pwdlen=$(echo "$pwd" | wc -c) +longpath=$(echo $longpath180 | cut -c 1-$((170-$pwdlen))) test_expect_success 'submodule with a long path' ' git init --bare remote &&