{"thread":{"id":"25191","subject":"test -L usage","startedAt":"2010-09-22T00:11:15Z","lastAt":"2010-09-22T00:37:30Z","messageCount":3,"participants":["Bruce Momjian","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151264","messageId":"201009220011.o8M0BFO26150@momjian.us","threadId":"25191","inReplyTo":null,"subject":"test -L usage","fromName":"Bruce Momjian","fromEmail":"bruce@momjian.us","sentAt":"2010-09-22T00:11:15Z","receivedAt":"2010-09-22T00:11:15Z","isPatch":false,"sender":{"key":"bruce@momjian.us","avatar":"https://gravatar.com/avatar/184f5a2e0ec6618cf501c8d2b6269b817aa54c017ac16e97486908e7496f8af6?d=mp&s=160"},"body":"git-1.7.3/contrib/workdir/git-new-workdir uses 'test -L' to test for\nsymlinks.  I suggest using 'test -h' because it is more portable, and\nwould have avoided a problem on my BSD machine.\n\n-- \n  Bruce Momjian  <bruce@momjian.us>        http://momjian.us\n  EnterpriseDB                             http://enterprisedb.com\n\n  + It's impossible for everything to be true. +\n"},{"id":"151267","messageId":"20100922003559.GB23931@sigill.intra.peff.net","threadId":"25191","inReplyTo":"201009220011.o8M0BFO26150@momjian.us","subject":"Re: test -L usage","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-09-22T00:35:59Z","receivedAt":"2010-09-22T00:35:59Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 21, 2010 at 08:11:15PM -0400, Bruce Momjian wrote:\n\n> git-1.7.3/contrib/workdir/git-new-workdir uses 'test -L' to test for\n> symlinks.  I suggest using 'test -h' because it is more portable, and\n> would have avoided a problem on my BSD machine.\n\nYeah, we generally do, but the stuff in contrib/ doesn't get exercised\nas much. There are also a few occurences in the svn tests. All cleaned\nup with the patch below.\n\n-->8--\nSubject: [PATCH] prefer test -h over test -L in shell scripts\n\nEven though \"-L\" is POSIX, the former is more portable, and\nwe tend to prefer it already.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n contrib/workdir/git-new-workdir  |    2 +-\n t/t9100-git-svn-basic.sh         |    6 +++---\n t/t9131-git-svn-empty-symlink.sh |    2 +-\n 3 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir\nindex 3ad2c0c..75e8b25 100755\n--- a/contrib/workdir/git-new-workdir\n+++ b/contrib/workdir/git-new-workdir\n@@ -42,7 +42,7 @@ then\n fi\n \n # don't link to a workdir\n-if test -L \"$git_dir/config\"\n+if test -h \"$git_dir/config\"\n then\n \tdie \"\\\"$orig_git\\\" is a working directory only, please specify\" \\\n \t\t\"a complete repository.\"\ndiff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\nindex 2f458f7..b041516 100755\n--- a/t/t9100-git-svn-basic.sh\n+++ b/t/t9100-git-svn-basic.sh\n@@ -143,7 +143,7 @@ test_expect_success \"$name\" '\n \tgit svn set-tree --find-copies-harder --rmdir \\\n \t\t${remotes_git_svn}..mybranch5 &&\n \tsvn_cmd up \"$SVN_TREE\" &&\n-\ttest -L \"$SVN_TREE\"/exec.sh'\n+\ttest -h \"$SVN_TREE\"/exec.sh'\n \n name='new symlink is added to a file that was also just made executable'\n \n@@ -156,7 +156,7 @@ test_expect_success \"$name\" '\n \t\t${remotes_git_svn}..mybranch5 &&\n \tsvn_cmd up \"$SVN_TREE\" &&\n \ttest -x \"$SVN_TREE\"/bar/zzz &&\n-\ttest -L \"$SVN_TREE\"/exec-2.sh'\n+\ttest -h \"$SVN_TREE\"/exec-2.sh'\n \n name='modify a symlink to become a file'\n test_expect_success \"$name\" '\n@@ -169,7 +169,7 @@ test_expect_success \"$name\" '\n \t\t${remotes_git_svn}..mybranch5 &&\n \tsvn_cmd up \"$SVN_TREE\" &&\n \ttest -f \"$SVN_TREE\"/exec-2.sh &&\n-\ttest ! -L \"$SVN_TREE\"/exec-2.sh &&\n+\ttest ! -h \"$SVN_TREE\"/exec-2.sh &&\n \ttest_cmp help \"$SVN_TREE\"/exec-2.sh'\n \n name=\"commit with UTF-8 message: locale: $GIT_SVN_LC_ALL\"\ndiff --git a/t/t9131-git-svn-empty-symlink.sh b/t/t9131-git-svn-empty-symlink.sh\nindex 9a24a65..f762038 100755\n--- a/t/t9131-git-svn-empty-symlink.sh\n+++ b/t/t9131-git-svn-empty-symlink.sh\n@@ -88,7 +88,7 @@ test_expect_success 'enable broken symlink workaround' \\\n test_expect_success '\"bar\" is an empty file' 'test -f x/bar && ! test -s x/bar'\n test_expect_success 'get \"bar\" => symlink fix from svn' \\\n \t\t'(cd x && git svn rebase)'\n-test_expect_success SYMLINKS '\"bar\" becomes a symlink' 'test -L x/bar'\n+test_expect_success SYMLINKS '\"bar\" becomes a symlink' 'test -h x/bar'\n \n \n test_expect_success 'clone using git svn' 'git svn clone -r1 \"$svnrepo\" y'\n-- \n1.7.3.256.gb9713\n"},{"id":"151268","messageId":"201009220037.o8M0bUT29845@momjian.us","threadId":"25191","inReplyTo":"20100922003559.GB23931@sigill.intra.peff.net","subject":"Re: test -L usage","fromName":"Bruce Momjian","fromEmail":"bruce@momjian.us","sentAt":"2010-09-22T00:37:30Z","receivedAt":"2010-09-22T00:37:30Z","isPatch":false,"sender":{"key":"bruce@momjian.us","avatar":"https://gravatar.com/avatar/184f5a2e0ec6618cf501c8d2b6269b817aa54c017ac16e97486908e7496f8af6?d=mp&s=160"},"body":"Jeff King wrote:\n> On Tue, Sep 21, 2010 at 08:11:15PM -0400, Bruce Momjian wrote:\n> \n> > git-1.7.3/contrib/workdir/git-new-workdir uses 'test -L' to test for\n> > symlinks.  I suggest using 'test -h' because it is more portable, and\n> > would have avoided a problem on my BSD machine.\n> \n> Yeah, we generally do, but the stuff in contrib/ doesn't get exercised\n> as much. There are also a few occurences in the svn tests. All cleaned\n> up with the patch below.\n\nThanks.\n\n-- \n  Bruce Momjian  <bruce@momjian.us>        http://momjian.us\n  EnterpriseDB                             http://enterprisedb.com\n\n  + It's impossible for everything to be true. +\n"}]}