{"thread":{"id":"31794","subject":"[minor] two tests broken when run with a --root directory that's a symlink","startedAt":"2012-10-11T21:55:53Z","lastAt":"2012-10-11T23:26:37Z","messageCount":4,"participants":["Ævar Arnfjörð Bjarmason","SZEDER Gábor","Michael Haggerty","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201026","messageId":"CACBZZX6Cu_4X=AywsDMebdoFYdEN1Gmp439aEAcehHBuMhziTw@mail.gmail.com","threadId":"31794","inReplyTo":null,"subject":"[minor] two tests broken when run with a --root directory that's a symlink","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2012-10-11T21:55:53Z","receivedAt":"2012-10-11T21:55:53Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"These issues are minor, I noticed it because I test with /dev/shm/git\nas the --root, which on Debian is symlinked to /run/..\n\n    $ rm -rf /tmp/{foo,bar}\n    $ mkdir /tmp/target; ln -s /tmp/target /tmp/link\n    $ prove ./t4035-diff-quiet.sh ./t9903-bash-prompt.sh :: --root=/tmp/target\n    ./t4035-diff-quiet.sh ... ok\n    ./t9903-bash-prompt.sh .. ok\n    All tests successful.\n    Files=2, Tests=64,  1 wallclock secs ( 0.04 usr  0.00 sys +  0.07\ncusr  0.06 csys =  0.17 CPU)\n    Result: PASS\n    $ prove ./t4035-diff-quiet.sh ./t9903-bash-prompt.sh :: --root=/tmp/link\n    ./t4035-diff-quiet.sh ... Dubious, test returned 1 (wstat 256, 0x100)\n    Failed 3/20 subtests\n    ./t9903-bash-prompt.sh .. Dubious, test returned 1 (wstat 256, 0x100)\n    Failed 6/44 subtests\n\nEverything else in the test suite passes with a --root that's a symlink.\n"},{"id":"201027","messageId":"1349995083-11765-1-git-send-email-szeder@ira.uka.de","threadId":"31794","inReplyTo":"CACBZZX6Cu_4X=AywsDMebdoFYdEN1Gmp439aEAcehHBuMhziTw@mail.gmail.com","subject":"[PATCH] bash prompt: fix tests when run with a symlink --root","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2012-10-11T22:38:03Z","receivedAt":"2012-10-11T22:38:03Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Some __gitdir() tests fail when they're run with a --root directory\nwhich is a symlink, because they use $TRASH_DIRECTORY to construct the\nexpected absolute paths.  Use the path got from 'pwd -P' instead\nthroughout the test script.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n t/t9903-bash-prompt.sh | 34 ++++++++++++++++++----------------\n 1 file changed, 18 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex f17c1f8b..7a7b198f 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -11,6 +11,8 @@ test_description='test git-specific bash prompt functions'\n \n actual=\"$TRASH_DIRECTORY/actual\"\n \n+TRASH_ROOT=\"$(pwd -P)\"\n+\n test_expect_success 'setup for prompt tests' '\n \tmkdir -p subdir/subsubdir &&\n \tgit init otherrepo &&\n@@ -32,9 +34,9 @@ test_expect_success 'setup for prompt tests' '\n '\n \n test_expect_success 'gitdir - from command line (through $__git_dir)' '\n-\techo \"$TRASH_DIRECTORY/otherrepo/.git\" > expected &&\n+\techo \"$TRASH_ROOT/otherrepo/.git\" > expected &&\n \t(\n-\t\t__git_dir=\"$TRASH_DIRECTORY/otherrepo/.git\" &&\n+\t\t__git_dir=\"$TRASH_ROOT/otherrepo/.git\" &&\n \t\t__gitdir > \"$actual\"\n \t) &&\n \ttest_cmp expected \"$actual\"\n@@ -59,7 +61,7 @@ test_expect_success 'gitdir - .git directory in cwd' '\n '\n \n test_expect_success 'gitdir - .git directory in parent' '\n-\techo \"$TRASH_DIRECTORY/.git\" > expected &&\n+\techo \"$TRASH_ROOT/.git\" > expected &&\n \t(\n \t\tcd subdir/subsubdir &&\n \t\t__gitdir > \"$actual\"\n@@ -77,7 +79,7 @@ test_expect_success 'gitdir - cwd is a .git directory' '\n '\n \n test_expect_success 'gitdir - parent is a .git directory' '\n-\techo \"$TRASH_DIRECTORY/.git\" > expected &&\n+\techo \"$TRASH_ROOT/.git\" > expected &&\n \t(\n \t\tcd .git/refs/heads &&\n \t\t__gitdir > \"$actual\"\n@@ -86,9 +88,9 @@ test_expect_success 'gitdir - parent is a .git directory' '\n '\n \n test_expect_success 'gitdir - $GIT_DIR set while .git directory in cwd' '\n-\techo \"$TRASH_DIRECTORY/otherrepo/.git\" > expected &&\n+\techo \"$TRASH_ROOT/otherrepo/.git\" > expected &&\n \t(\n-\t\tGIT_DIR=\"$TRASH_DIRECTORY/otherrepo/.git\" &&\n+\t\tGIT_DIR=\"$TRASH_ROOT/otherrepo/.git\" &&\n \t\texport GIT_DIR &&\n \t\t__gitdir > \"$actual\"\n \t) &&\n@@ -96,9 +98,9 @@ test_expect_success 'gitdir - $GIT_DIR set while .git directory in cwd' '\n '\n \n test_expect_success 'gitdir - $GIT_DIR set while .git directory in parent' '\n-\techo \"$TRASH_DIRECTORY/otherrepo/.git\" > expected &&\n+\techo \"$TRASH_ROOT/otherrepo/.git\" > expected &&\n \t(\n-\t\tGIT_DIR=\"$TRASH_DIRECTORY/otherrepo/.git\" &&\n+\t\tGIT_DIR=\"$TRASH_ROOT/otherrepo/.git\" &&\n \t\texport GIT_DIR &&\n \t\tcd subdir &&\n \t\t__gitdir > \"$actual\"\n@@ -108,15 +110,15 @@ test_expect_success 'gitdir - $GIT_DIR set while .git directory in parent' '\n \n test_expect_success 'gitdir - non-existing $GIT_DIR' '\n \t(\n-\t\tGIT_DIR=\"$TRASH_DIRECTORY/non-existing\" &&\n+\t\tGIT_DIR=\"$TRASH_ROOT/non-existing\" &&\n \t\texport GIT_DIR &&\n \t\ttest_must_fail __gitdir\n \t)\n '\n \n test_expect_success 'gitdir - gitfile in cwd' '\n-\techo \"$TRASH_DIRECTORY/otherrepo/.git\" > expected &&\n-\techo \"gitdir: $TRASH_DIRECTORY/otherrepo/.git\" > subdir/.git &&\n+\techo \"$TRASH_ROOT/otherrepo/.git\" > expected &&\n+\techo \"gitdir: $TRASH_ROOT/otherrepo/.git\" > subdir/.git &&\n \ttest_when_finished \"rm -f subdir/.git\" &&\n \t(\n \t\tcd subdir &&\n@@ -126,8 +128,8 @@ test_expect_success 'gitdir - gitfile in cwd' '\n '\n \n test_expect_success 'gitdir - gitfile in parent' '\n-\techo \"$TRASH_DIRECTORY/otherrepo/.git\" > expected &&\n-\techo \"gitdir: $TRASH_DIRECTORY/otherrepo/.git\" > subdir/.git &&\n+\techo \"$TRASH_ROOT/otherrepo/.git\" > expected &&\n+\techo \"gitdir: $TRASH_ROOT/otherrepo/.git\" > subdir/.git &&\n \ttest_when_finished \"rm -f subdir/.git\" &&\n \t(\n \t\tcd subdir/subsubdir &&\n@@ -137,7 +139,7 @@ test_expect_success 'gitdir - gitfile in parent' '\n '\n \n test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' '\n-\techo \"$TRASH_DIRECTORY/otherrepo/.git\" > expected &&\n+\techo \"$TRASH_ROOT/otherrepo/.git\" > expected &&\n \tmkdir otherrepo/dir &&\n \ttest_when_finished \"rm -rf otherrepo/dir\" &&\n \tln -s otherrepo/dir link &&\n@@ -152,7 +154,7 @@ test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' '\n test_expect_success 'gitdir - not a git repository' '\n \t(\n \t\tcd subdir/subsubdir &&\n-\t\tGIT_CEILING_DIRECTORIES=\"$TRASH_DIRECTORY\" &&\n+\t\tGIT_CEILING_DIRECTORIES=\"$TRASH_ROOT\" &&\n \t\texport GIT_CEILING_DIRECTORIES &&\n \t\ttest_must_fail __gitdir\n \t)\n@@ -250,7 +252,7 @@ echo \"edit $(git log -1 --format=\"%h\")\" > \"$1\"\n EOF\n \ttest_when_finished \"rm -f fake_editor.sh\" &&\n \tchmod a+x fake_editor.sh &&\n-\ttest_set_editor \"$TRASH_DIRECTORY/fake_editor.sh\" &&\n+\ttest_set_editor \"$TRASH_ROOT/fake_editor.sh\" &&\n \tgit checkout b1 &&\n \ttest_when_finished \"git checkout master\" &&\n \tgit rebase -i HEAD^ &&\n-- \n1.8.0.rc0.83.gc8e1777\n"},{"id":"201029","messageId":"50774D25.6000403@alum.mit.edu","threadId":"31794","inReplyTo":"CACBZZX6Cu_4X=AywsDMebdoFYdEN1Gmp439aEAcehHBuMhziTw@mail.gmail.com","subject":"Re: [minor] two tests broken when run with a --root directory that's a symlink","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-10-11T22:50:13Z","receivedAt":"2012-10-11T22:50:13Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 10/11/2012 11:55 PM, Ævar Arnfjörð Bjarmason wrote:\n> These issues are minor, I noticed it because I test with /dev/shm/git\n> as the --root, which on Debian is symlinked to /run/..\n> \n>     $ rm -rf /tmp/{foo,bar}\n>     $ mkdir /tmp/target; ln -s /tmp/target /tmp/link\n>     $ prove ./t4035-diff-quiet.sh ./t9903-bash-prompt.sh :: --root=/tmp/target\n>     ./t4035-diff-quiet.sh ... ok\n>     ./t9903-bash-prompt.sh .. ok\n>     All tests successful.\n>     Files=2, Tests=64,  1 wallclock secs ( 0.04 usr  0.00 sys +  0.07\n> cusr  0.06 csys =  0.17 CPU)\n>     Result: PASS\n>     $ prove ./t4035-diff-quiet.sh ./t9903-bash-prompt.sh :: --root=/tmp/link\n>     ./t4035-diff-quiet.sh ... Dubious, test returned 1 (wstat 256, 0x100)\n>     Failed 3/20 subtests\n>     ./t9903-bash-prompt.sh .. Dubious, test returned 1 (wstat 256, 0x100)\n>     Failed 6/44 subtests\n> \n> Everything else in the test suite passes with a --root that's a symlink.\n\nI ran into the same problem a while ago, and submitted a patch series\nthat fixes t4035 (whose problems are related to GIT_CEILING_DIRECTORIES):\n\n    http://thread.gmane.org/gmane.comp.version-control.git/206633\n\nJunio didn't like the approach so much and I haven't yet had time to\nsubmit a revised version.\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"201031","messageId":"7vpq4o615e.fsf@alter.siamese.dyndns.org","threadId":"31794","inReplyTo":"50774D25.6000403@alum.mit.edu","subject":"Re: [minor] two tests broken when run with a --root directory that's a symlink","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-10-11T23:26:37Z","receivedAt":"2012-10-11T23:26:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Haggerty <mhagger@alum.mit.edu> writes:\n\n> I ran into the same problem a while ago, and submitted a patch series\n> that fixes t4035 (whose problems are related to GIT_CEILING_DIRECTORIES):\n>\n>     http://thread.gmane.org/gmane.comp.version-control.git/206633\n>\n> Junio didn't like the approach so much and I haven't yet had time to\n> submit a revised version.\n\nI like the approach of comparing each element of CEILING and the\ndirectory not before but after resolving any symlinks in them.\n\nMy comments was only about the implementation that seemed to make\nthe API layering boundary more complex than necessary.\n"}]}