{"thread":{"id":"7805","subject":"[PATCH] Fix tests when using bash_completion","startedAt":"2007-04-23T20:51:29Z","lastAt":"2007-04-24T19:01:00Z","messageCount":8,"participants":["Ron Parker","Junio C Hamano","Julian Phillips"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"40239","messageId":"769697AE3E25EF4FBC0763CD91AB1B0201D496D0@MBGMail01.mobot.org","threadId":"7805","inReplyTo":null,"subject":"[PATCH] Fix tests when using bash_completion","fromName":"Ron Parker","fromEmail":"ron.parker@mobot.org","sentAt":"2007-04-23T20:51:29Z","receivedAt":"2007-04-23T20:51:29Z","isPatch":true,"sender":{"key":"ron.parker@mobot.org","avatar":null},"body":"When using bash_completion, 'cd' echos the target directory name to\nstandard\nout.  If 'cd' participates in a pipe whose output is compared against an\nexpected value, this causes a false failure report.  Pipe cd's stdout to\n/dev/null in these cases.\n\nSigned-off-by: Ron Parker <ron.parker@mobot.org>\n---\n\n\tI was going to look into some of the preliminary subproject\n\tsupport, since I have a need for it.  But a bunch of the tests\n\tfailed because I run the bash_completion package.\n\n\tI don't think I've sent any patches for git before.  Please be\n\tgentle.  If there is a problem with this patch or the way I've\n\tsent it, I'll gladly redo it.\n\n t/t3040-subprojects-basic.sh |    2 +-\n t/t5000-tar-tree.sh          |   10 +++++-----\n t/t5500-fetch-pack.sh        |    8 ++++----\n t/t5502-quickfetch.sh        |    8 ++++----\n t/t7002-grep.sh              |    4 ++--\n 5 files changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t3040-subprojects-basic.sh b/t/t3040-subprojects-basic.sh\nindex 79b9f23..9543921 100755\n--- a/t/t3040-subprojects-basic.sh\n+++ b/t/t3040-subprojects-basic.sh\n@@ -61,7 +61,7 @@ test_expect_success 'check if git diff works for\nsubproject elements' \\\n test_expect_success 'check if clone works' \\\n     'git ls-files -s >expected &&\n     git clone -l -s . cloned &&\n-    ( cd cloned && git ls-files -s ) >current &&\n+    ( cd cloned >/dev/null && git ls-files -s ) >current &&\n     git diff expected current'\n \n test_expect_success 'removing and adding subproject' \\\ndiff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\nindex e223c07..a6654a3 100755\n--- a/t/t5000-tar-tree.sh\n+++ b/t/t5000-tar-tree.sh\n@@ -38,7 +38,7 @@ test_expect_success \\\n      (p=long_path_to_a_file && cd a &&\n       for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&\n       echo text >file_with_long_path) &&\n-     (cd a && find .) | sort >a.lst'\n+     (cd a >/dev/null && find .) | sort >a.lst'\n \n test_expect_success \\\n     'add files to repository' \\\n@@ -80,7 +80,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'validate filenames' \\\n-    '(cd b/a && find .) | sort >b.lst &&\n+    '(cd b/a >/dev/null && find .) | sort >b.lst &&\n      diff a.lst b.lst'\n \n test_expect_success \\\n@@ -97,7 +97,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'validate filenames with prefix' \\\n-    '(cd c/prefix/a && find .) | sort >c.lst &&\n+    '(cd c/prefix/a >/dev/null && find .) | sort >c.lst &&\n      diff a.lst c.lst'\n \n test_expect_success \\\n@@ -114,7 +114,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'validate filenames' \\\n-    '(cd d/a && find .) | sort >d.lst &&\n+    '(cd d/a >/dev/null && find .) | sort >d.lst &&\n      diff a.lst d.lst'\n \n test_expect_success \\\n@@ -131,7 +131,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'validate filenames with prefix' \\\n-    '(cd e/prefix/a && find .) | sort >e.lst &&\n+    '(cd e/prefix/a >/dev/null && find .) | sort >e.lst &&\n      diff a.lst e.lst'\n \n test_expect_success \\\ndiff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\nindex 48e3d17..d8ed508 100755\n--- a/t/t5500-fetch-pack.sh\n+++ b/t/t5500-fetch-pack.sh\n@@ -131,7 +131,7 @@ pull_to_client 3rd \"A\" $((1*3)) # old fails\n \n test_expect_success \"clone shallow\" \"git-clone --depth 2 . shallow\"\n \n-(cd shallow; git-count-objects -v) > count.shallow\n+(cd shallow >/dev/null; git-count-objects -v) > count.shallow\n \n test_expect_success \"clone shallow object count\" \\\n \t\"test \\\"in-pack: 18\\\" = \\\"$(grep in-pack count.shallow)\\\"\"\n@@ -155,7 +155,7 @@ add B67 $B66\n test_expect_success \"pull in shallow repo\" \\\n \t\"(cd shallow; git pull .. B)\"\n \n-(cd shallow; git-count-objects -v) > count.shallow\n+(cd shallow >/dev/null; git-count-objects -v) > count.shallow\n test_expect_success \"clone shallow object count\" \\\n \t\"test \\\"count: 6\\\" = \\\"$(grep count count.shallow)\\\"\"\n \n@@ -165,14 +165,14 @@ add B69 $B68\n test_expect_success \"deepening pull in shallow repo\" \\\n \t\"(cd shallow; git pull --depth 4 .. B)\"\n \n-(cd shallow; git-count-objects -v) > count.shallow\n+(cd shallow >/dev/null; git-count-objects -v) > count.shallow\n test_expect_success \"clone shallow object count\" \\\n \t\"test \\\"count: 12\\\" = \\\"$(grep count count.shallow)\\\"\"\n \n test_expect_success \"deepening fetch in shallow repo\" \\\n \t\"(cd shallow; git fetch --depth 4 .. A:A)\"\n \n-(cd shallow; git-count-objects -v) > count.shallow\n+(cd shallow >/dev/null; git-count-objects -v) > count.shallow\n test_expect_success \"clone shallow object count\" \\\n \t\"test \\\"count: 18\\\" = \\\"$(grep count count.shallow)\\\"\"\n \ndiff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh\nindex b4760f2..b33e414 100755\n--- a/t/t5502-quickfetch.sh\n+++ b/t/t5502-quickfetch.sh\n@@ -26,7 +26,7 @@ test_expect_success 'clone without alternate' '\n \t\tgit remote add -f origin ..\n \t) &&\n \tcnt=$( (\n-\t\tcd cloned &&\n+\t\tcd cloned >/dev/null &&\n \t\tgit count-objects | sed -e \"s/ *objects,.*//\"\n \t) ) &&\n \ttest $cnt -eq 3\n@@ -54,7 +54,7 @@ test_expect_success 'copy commit and tree but not blob\nby hand' '\n \t) &&\n \n \tcnt=$( (\n-\t\tcd cloned &&\n+\t\tcd cloned >/dev/null &&\n \t\tgit count-objects | sed -e \"s/ *objects,.*//\"\n \t) ) &&\n \ttest $cnt -eq 6\n@@ -64,7 +64,7 @@ test_expect_success 'copy commit and tree but not blob\nby hand' '\n \trm -f \"cloned/.git/objects/$blob\" &&\n \n \tcnt=$( (\n-\t\tcd cloned &&\n+\t\tcd cloned >/dev/null &&\n \t\tgit count-objects | sed -e \"s/ *objects,.*//\"\n \t) ) &&\n \ttest $cnt -eq 5\n@@ -79,7 +79,7 @@ test_expect_success 'quickfetch should not leave a\ncorrupted repository' '\n \t) &&\n \n \tcnt=$( (\n-\t\tcd cloned &&\n+\t\tcd cloned >/dev/null &&\n \t\tgit count-objects | sed -e \"s/ *objects,.*//\"\n \t) ) &&\n \ttest $cnt -eq 6\ndiff --git a/t/t7002-grep.sh b/t/t7002-grep.sh\nindex 6bfb899..5d2fc4a 100755\n--- a/t/t7002-grep.sh\n+++ b/t/t7002-grep.sh\n@@ -92,7 +92,7 @@ do\n \ttest_expect_success \"grep $L (t-2)\" '\n \t\techo \"${HC}t:1:test\" >expected &&\n \t\t(\n-\t\t\tcd t &&\n+\t\t\tcd t >/dev/null &&\n \t\t\tgit grep -n -e test $H\n \t\t) >actual &&\n \t\tdiff expected actual\n@@ -101,7 +101,7 @@ do\n \ttest_expect_success \"grep $L (t-3)\" '\n \t\techo \"${HC}t/t:1:test\" >expected &&\n \t\t(\n-\t\t\tcd t &&\n+\t\t\tcd t >/dev/null &&\n \t\t\tgit grep --full-name -n -e test $H\n \t\t) >actual &&\n \t\tdiff expected actual\n-- \n1.5.2.rc0.1.g2cc31\n"},{"id":"40240","messageId":"7vvefmeqs6.fsf@assigned-by-dhcp.cox.net","threadId":"7805","inReplyTo":"769697AE3E25EF4FBC0763CD91AB1B0201D496D0@MBGMail01.mobot.org","subject":"Re: [PATCH] Fix tests when using bash_completion","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-23T21:15:21Z","receivedAt":"2007-04-23T21:15:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Ron Parker\" <ron.parker@mobot.org> writes:\n\n> When using bash_completion, 'cd' echos the target directory name to\n> standard\n> out.  If 'cd' participates in a pipe whose output is compared against an\n> expected value, this causes a false failure report.  Pipe cd's stdout to\n> /dev/null in these cases.\n\nThis is way too ugly.\n\nAre you sure bash-completion is the culprit, not your CDPATH?\n"},{"id":"40243","messageId":"Pine.LNX.4.64.0704232235280.7626@beast.quantumfyre.co.uk","threadId":"7805","inReplyTo":"7vvefmeqs6.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix tests when using bash_completion","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-04-23T21:39:20Z","receivedAt":"2007-04-23T21:39:20Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Mon, 23 Apr 2007, Junio C Hamano wrote:\n\n> \"Ron Parker\" <ron.parker@mobot.org> writes:\n>\n>> When using bash_completion, 'cd' echos the target directory name to\n>> standard\n>> out.  If 'cd' participates in a pipe whose output is compared against an\n>> expected value, this causes a false failure report.  Pipe cd's stdout to\n>> /dev/null in these cases.\n>\n> This is way too ugly.\n>\n> Are you sure bash-completion is the culprit, not your CDPATH?\n\neven with bash-completion _and_ CDPATH I only get a print when changing to \na directory in CDPATH not the current directory ... perhaps an alias set \nfor cd?\n\n(I'm not the only one who thinks CDPATH is ick am I? :S)\n\n-- \nJulian\n\n  ---\nBOFH Excuse #350:\n\nparadigm shift...without a clutch\n"},{"id":"40245","messageId":"7vvefmdab8.fsf@assigned-by-dhcp.cox.net","threadId":"7805","inReplyTo":"Pine.LNX.4.64.0704232235280.7626@beast.quantumfyre.co.uk","subject":"Re: [PATCH] Fix tests when using bash_completion","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-23T21:56:27Z","receivedAt":"2007-04-23T21:56:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Julian Phillips <julian@quantumfyre.co.uk> writes:\n\n> (I'm not the only one who thinks CDPATH is ick am I? :S)\n\nCDPATH is Ok as long as it stays as an interactive shell\nvariable.\n\nSadly, if you google for \"CDPATH environment\", you would see\nmany many hits.  That variable is not meant to be used as an\nenvironment variable.\n\nSomething like this in .bashrc is acceptable:\n\n\tcase \"$PS1\" in\n        '')\n        \t;; # do not do useless thing for noninteractive\n\t?*)\n        \tCDPATH=my:favorite:path\n                . $HOME/.bash-completion\n\t\t;;\n\tesac\n\nbut people usually are way too careless than that and export\nCDPATH to the environment, and that is where breakages start.\n"},{"id":"40253","messageId":"Pine.LNX.4.64.0704232351530.8430@beast.quantumfyre.co.uk","threadId":"7805","inReplyTo":"7vvefmdab8.fsf@assigned-by-dhcp.cox.net","subject":"[OT] CDPATH (was: Re: [PATCH] Fix tests when using bash_completion)","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-04-23T22:57:27Z","receivedAt":"2007-04-23T22:57:27Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Mon, 23 Apr 2007, Junio C Hamano wrote:\n\n> Julian Phillips <julian@quantumfyre.co.uk> writes:\n>\n>> (I'm not the only one who thinks CDPATH is ick am I? :S)\n>\n> CDPATH is Ok as long as it stays as an interactive shell\n> variable.\n>\n> Sadly, if you google for \"CDPATH environment\", you would see\n> many many hits.  That variable is not meant to be used as an\n> environment variable.\n\nTrue - though personally I tend to use more discriminate shell functions \nanyway.\n\n>\n> Something like this in .bashrc is acceptable:\n>\n> \tcase \"$PS1\" in\n>        '')\n>        \t;; # do not do useless thing for noninteractive\n> \t?*)\n>        \tCDPATH=my:favorite:path\n>                . $HOME/.bash-completion\n> \t\t;;\n> \tesac\n>\n> but people usually are way too careless than that and export\n> CDPATH to the environment, and that is where breakages start.\n\nI guess part of the problem is that a lot of these people don't actually \nunderstand the difference between shell variables and environment \nvariables, or why the distinction is useful.  Plenty of people seem to do \n\"export FOO=...\" by rote.\n\n-- \nJulian\n\n  ---\nAnyone can hold the helm when the sea is calm.\n \t\t-- Publius Syrus\n"},{"id":"40326","messageId":"769697AE3E25EF4FBC0763CD91AB1B0201D496D1@MBGMail01.mobot.org","threadId":"7805","inReplyTo":"Pine.LNX.4.64.0704232351530.8430@beast.quantumfyre.co.uk","subject":"RE: [OT] CDPATH","fromName":"Ron Parker","fromEmail":"ron.parker@mobot.org","sentAt":"2007-04-24T13:34:22Z","receivedAt":"2007-04-24T13:34:22Z","isPatch":false,"sender":{"key":"ron.parker@mobot.org","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n\n> Are you sure bash-completion is the culprit, not your CDPATH?\n\nSorry, I was half-asleep yesterday.  Of course it was CDPATH and not \nbash-completion.\n\nJulian Phillips <julian@quantumfyre.co.uk> wrote:\n\n> CDPATH is Ok as long as it stays as an interactive shell\n> variable.\n\nBased on a shell I used years ago that had built-in functionality similar to\nCDPATH, I naïvely *assumed* CDPATH would only impact interactive shells.\n\nIn another message, Julian wrote:\n\n> I guess part of the problem is that a lot of these people don't actually \n> understand the difference between shell variables and environment \n> variables, or why the distinction is useful.  Plenty of people seem to do \n> \"export FOO=...\" by rote.\n\nNot quite my case, but assumptions are dangerous things.  Based on my \nassumption, I intentionally exported CDPATH so it would propagate when\nI \"xterm&\".  Grr, I guess I'll have to alias xterm instead.\n\nThanks for the enlightenment gentlemen.\n\nYet another reason I like \"git reset --hard HEAD\" for stupid patch removal.\n\nNow if there was a \"reset --hard HEAD\" function for some people I've met...\n\nThanks,\n\nRon\n"},{"id":"40347","messageId":"7vejm97lsi.fsf@assigned-by-dhcp.cox.net","threadId":"7805","inReplyTo":"769697AE3E25EF4FBC0763CD91AB1B0201D496D1@MBGMail01.mobot.org","subject":"Re: [OT] CDPATH","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-24T16:57:17Z","receivedAt":"2007-04-24T16:57:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Ron Parker\" <ron.parker@mobot.org> writes:\n\n> Junio C Hamano <junkio@cox.net> wrote:\n>\n>> Are you sure bash-completion is the culprit, not your CDPATH?\n>\n> Sorry, I was half-asleep yesterday.  Of course it was CDPATH and not \n> bash-completion.\n\nThanks for confirmation.  This suggests in t/test-lib.sh we'd\nbetter have \"unset CDPATH\" near the top to prevent surprises\nlike this.\n"},{"id":"40362","messageId":"769697AE3E25EF4FBC0763CD91AB1B0201D496D3@MBGMail01.mobot.org","threadId":"7805","inReplyTo":"7vejm97lsi.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Unset CDPATH in the test library","fromName":"Ron Parker","fromEmail":"ron.parker@mobot.org","sentAt":"2007-04-24T19:01:00Z","receivedAt":"2007-04-24T19:01:00Z","isPatch":true,"sender":{"key":"ron.parker@mobot.org","avatar":null},"body":"\nSigned-off-by: Ron Parker <ron.parker@mobot.org>\n---\n\n\tJunio,\n\n\tYour suggestion of unsetting CDPATH in\n\tt/test-lib.sh took care of the problem.\n\n\tThanks.\n\n t/test-lib.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex c075474..8b99a76 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -11,6 +11,7 @@ TZ=UTC\n export LANG LC_ALL PAGER TZ\n EDITOR=:\n VISUAL=:\n+unset CDPATH\n unset AUTHOR_DATE\n unset AUTHOR_EMAIL\n unset AUTHOR_NAME\n-- \n1.5.0.5\n"}]}