Avoid using non-portable `echo -n` in tests.

Expecting echo to recognise -n is a BSDism.  Using printf is far more
portable.

Discovered on OS X 10.5.5 in t4030-diff-textconv.sh and changed in all
the test scripts.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brian Gernhardt 2008-10-31 01:09:13 -04:00 коммит произвёл Junio C Hamano
Родитель df5e91fc2c
Коммит 6ecfd91df5
5 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -13,7 +13,7 @@ file if core.symlinks is false.'
test_expect_success \ test_expect_success \
'preparation' ' 'preparation' '
git config core.symlinks false && git config core.symlinks false &&
l=$(echo -n file | git hash-object -t blob -w --stdin) && l=$(printf file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info' echo "120000 $l symlink" | git update-index --index-info'
test_expect_success \ test_expect_success \

Просмотреть файл

@ -13,12 +13,12 @@ even if a plain file is in the working tree if core.symlinks is false.'
test_expect_success \ test_expect_success \
'preparation' ' 'preparation' '
git config core.symlinks false && git config core.symlinks false &&
l=$(echo -n file | git hash-object -t blob -w --stdin) && l=$(printf file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info' echo "120000 $l symlink" | git update-index --index-info'
test_expect_success \ test_expect_success \
'modify the symbolic link' ' 'modify the symbolic link' '
echo -n new-file > symlink && printf new-file > symlink &&
git update-index symlink' git update-index symlink'
test_expect_success \ test_expect_success \

Просмотреть файл

@ -105,7 +105,7 @@ index ad8b3d2..67be421
EOF EOF
# make a symlink the hard way that works on symlink-challenged file systems # make a symlink the hard way that works on symlink-challenged file systems
test_expect_failure 'textconv does not act on symlinks' ' test_expect_failure 'textconv does not act on symlinks' '
echo -n frotz > file && printf frotz > file &&
git add file && git add file &&
git ls-files -s | sed -e s/100644/120000/ | git ls-files -s | sed -e s/100644/120000/ |
git update-index --index-info && git update-index --index-info &&

Просмотреть файл

@ -18,11 +18,11 @@ git add file &&
git commit -m initial && git commit -m initial &&
git branch b-symlink && git branch b-symlink &&
git branch b-file && git branch b-file &&
l=$(echo -n file | git hash-object -t blob -w --stdin) && l=$(printf file | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info && echo "120000 $l symlink" | git update-index --index-info &&
git commit -m master && git commit -m master &&
git checkout b-symlink && git checkout b-symlink &&
l=$(echo -n file-different | git hash-object -t blob -w --stdin) && l=$(printf file-different | git hash-object -t blob -w --stdin) &&
echo "120000 $l symlink" | git update-index --index-info && echo "120000 $l symlink" | git update-index --index-info &&
git commit -m b-symlink && git commit -m b-symlink &&
git checkout b-file && git checkout b-file &&

Просмотреть файл

@ -424,7 +424,7 @@ cd "$WORKDIR"
test_expect_success 'cvs update (-p)' ' test_expect_success 'cvs update (-p)' '
touch really-empty && touch really-empty &&
echo Line 1 > no-lf && echo Line 1 > no-lf &&
echo -n Line 2 >> no-lf && printf "Line 2" >> no-lf &&
git add really-empty no-lf && git add really-empty no-lf &&
git commit -q -m "Update -p test" && git commit -q -m "Update -p test" &&
git push gitcvs.git >/dev/null && git push gitcvs.git >/dev/null &&