@matheusbsbs / matheus-bagliano / commits / afa0876050
Fork 0

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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 21, 2010 at 20:35 UTC afa0876050496d4250e8b27680e5cbc60fbda760
3 files changed +5 -5
contrib/workdir/git-new-workdir
+1 -1
@@ -42,7 +42,7 @@ then
42 fi
43
44 # don't link to a workdir
45 -if test -L "$git_dir/config"
45 +if test -h "$git_dir/config"
46 then
47 die "\"$orig_git\" is a working directory only, please specify" \
48 "a complete repository."
t/t9100-git-svn-basic.sh
+3 -3
@@ -143,7 +143,7 @@ test_expect_success "$name" '
143 git svn set-tree --find-copies-harder --rmdir \
144 ${remotes_git_svn}..mybranch5 &&
145 svn_cmd up "$SVN_TREE" &&
146 - test -L "$SVN_TREE"/exec.sh'
146 + test -h "$SVN_TREE"/exec.sh'
147
148 name='new symlink is added to a file that was also just made executable'
149
@@ -156,7 +156,7 @@ test_expect_success "$name" '
156 ${remotes_git_svn}..mybranch5 &&
157 svn_cmd up "$SVN_TREE" &&
158 test -x "$SVN_TREE"/bar/zzz &&
159 - test -L "$SVN_TREE"/exec-2.sh'
159 + test -h "$SVN_TREE"/exec-2.sh'
160
161 name='modify a symlink to become a file'
162 test_expect_success "$name" '
@@ -169,7 +169,7 @@ test_expect_success "$name" '
169 ${remotes_git_svn}..mybranch5 &&
170 svn_cmd up "$SVN_TREE" &&
171 test -f "$SVN_TREE"/exec-2.sh &&
172 - test ! -L "$SVN_TREE"/exec-2.sh &&
172 + test ! -h "$SVN_TREE"/exec-2.sh &&
173 test_cmp help "$SVN_TREE"/exec-2.sh'
174
175 name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
t/t9131-git-svn-empty-symlink.sh
+1 -1
@@ -88,7 +88,7 @@ test_expect_success 'enable broken symlink workaround' \
88 test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
89 test_expect_success 'get "bar" => symlink fix from svn' \
90 '(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'
92
93
94 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'