Skip to content

Commit afa0876

Browse files
peffgitster
authored andcommitted
prefer test -h over test -L in shell scripts
Even though "-L" is POSIX, the former is more portable, and we tend to prefer it already. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 055467d commit afa0876

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

contrib/workdir/git-new-workdir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ then
4242
fi
4343

4444
# don't link to a workdir
45-
if test -L "$git_dir/config"
45+
if test -h "$git_dir/config"
4646
then
4747
die "\"$orig_git\" is a working directory only, please specify" \
4848
"a complete repository."

t/t9100-git-svn-basic.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ test_expect_success "$name" '
143143
git svn set-tree --find-copies-harder --rmdir \
144144
${remotes_git_svn}..mybranch5 &&
145145
svn_cmd up "$SVN_TREE" &&
146-
test -L "$SVN_TREE"/exec.sh'
146+
test -h "$SVN_TREE"/exec.sh'
147147

148148
name='new symlink is added to a file that was also just made executable'
149149

@@ -156,7 +156,7 @@ test_expect_success "$name" '
156156
${remotes_git_svn}..mybranch5 &&
157157
svn_cmd up "$SVN_TREE" &&
158158
test -x "$SVN_TREE"/bar/zzz &&
159-
test -L "$SVN_TREE"/exec-2.sh'
159+
test -h "$SVN_TREE"/exec-2.sh'
160160

161161
name='modify a symlink to become a file'
162162
test_expect_success "$name" '
@@ -169,7 +169,7 @@ test_expect_success "$name" '
169169
${remotes_git_svn}..mybranch5 &&
170170
svn_cmd up "$SVN_TREE" &&
171171
test -f "$SVN_TREE"/exec-2.sh &&
172-
test ! -L "$SVN_TREE"/exec-2.sh &&
172+
test ! -h "$SVN_TREE"/exec-2.sh &&
173173
test_cmp help "$SVN_TREE"/exec-2.sh'
174174

175175
name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"

t/t9131-git-svn-empty-symlink.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ test_expect_success 'enable broken symlink workaround' \
8888
test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
8989
test_expect_success 'get "bar" => symlink fix from svn' \
9090
'(cd x && git svn rebase)'
91-
test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -L x/bar'
91+
test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -h x/bar'
9292

9393

9494
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'

0 commit comments

Comments
 (0)