Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Avoid bash-ism
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Jan 27, 2014
1 parent 942ba3e commit a81f137
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions t/t7410-submodule-long-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit a81f137

Please sign in to comment.