{"thread":{"id":"27820","subject":"[PATCH] ref namespaces: tests","startedAt":"2011-07-14T20:50:57Z","lastAt":"2011-07-22T22:32:13Z","messageCount":8,"participants":["Josh Triplett","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"171382","messageId":"20110714205055.GA26956@leaf","threadId":"27820","inReplyTo":null,"subject":"[PATCH] ref namespaces: tests","fromName":"Josh Triplett","fromEmail":"josh@joshtriplett.org","sentAt":"2011-07-14T20:50:57Z","receivedAt":"2011-07-14T20:50:57Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"Test pushing, pulling, and mirroring of repositories with ref\nnamespaces.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n\nThe most recent \"What's cooking\" suggested that the ref namespaces\npatches needed tests.  This test works with PATCHv10, currently in pu.\nPlease append this patch to the js/ref-namespaces branch.\n\n t/t5502-fetch-push-namespaces.sh |   77 ++++++++++++++++++++++++++++++++++++++\n 1 files changed, 77 insertions(+), 0 deletions(-)\n create mode 100755 t/t5502-fetch-push-namespaces.sh\n\ndiff --git a/t/t5502-fetch-push-namespaces.sh b/t/t5502-fetch-push-namespaces.sh\nnew file mode 100755\nindex 0000000..85720b6\n--- /dev/null\n+++ b/t/t5502-fetch-push-namespaces.sh\n@@ -0,0 +1,77 @@\n+#!/bin/sh\n+\n+test_description='fetch/push involving ref namespaces'\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\ttest_tick &&\n+\tgit init original &&\n+\t(\n+\t\tcd original &&\n+\t\ti=0 &&\n+\t\twhile [ \"$i\" -lt 2 ]\n+\t\tdo\n+\t\t\techo \"$i\" > count &&\n+\t\t\tgit add count &&\n+\t\t\ttest_commit \"$i\" &&\n+\t\t\ti=$(($i + 1))\n+\t\tdone &&\n+\t\tgit remote add pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n+\t\tgit remote add pushee-unnamespaced ../pushee\n+\t) &&\n+\tgit init pushee &&\n+\tgit init puller\n+'\n+\n+test_expect_success 'pushing into a repository using a ref namespace' '\n+\t(\n+\t\tcd original &&\n+\t\tgit push pushee-namespaced master &&\n+\t\tgit ls-remote pushee-namespaced > actual &&\n+\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba\\trefs/heads/master\\n\" > expected &&\n+\t\ttest_cmp expected actual &&\n+\t\tgit push pushee-namespaced --tags &&\n+\t\tgit ls-remote pushee-namespaced > actual &&\n+\t\tprintf \"fbdf4310c71b916568f04753f603fb24a0544227\\trefs/tags/0\\n\" >> expected &&\n+\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba\\trefs/tags/1\\n\" >> expected &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Verify that the GIT_NAMESPACE environment variable works as well\n+\t\tGIT_NAMESPACE=namespace git ls-remote \"ext::git %s ../pushee\" > actual &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Verify that --namespace overrides GIT_NAMESPACE\n+\t\tGIT_NAMESPACE=garbage git ls-remote pushee-namespaced > actual &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Try a namespace with no content\n+\t\tgit ls-remote \"ext::git --namespace=garbage %s ../pushee\" > actual &&\n+\t\ttest_cmp /dev/null actual &&\n+\t\tgit ls-remote pushee-unnamespaced > actual &&\n+\t\tsed -e \"s|refs/|refs/namespaces/namespace/refs/|\" expected > expected.unnamespaced &&\n+\t\ttest_cmp expected.unnamespaced actual\n+\t)\n+'\n+\n+test_expect_success 'pulling from a repository using a ref namespace' '\n+\t(\n+\t\tcd puller &&\n+\t\tgit remote add -f pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n+\t\tgit for-each-ref refs/ > actual &&\n+\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/remotes/pushee-namespaced/master\\n\" > expected &&\n+\t\tprintf \"fbdf4310c71b916568f04753f603fb24a0544227 commit\\trefs/tags/0\\n\" >> expected &&\n+\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/tags/1\\n\" >> expected &&\n+\t\ttest_cmp expected actual\n+\t)\n+'\n+\n+test_expect_success 'mirroring a repository using a ref namespace' '\n+\tgit clone --mirror pushee mirror &&\n+\t(\n+\t\tcd mirror &&\n+\t\tgit for-each-ref refs/ > actual &&\n+\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/namespaces/namespace/refs/heads/master\\n\" > expected &&\n+\t\tprintf \"fbdf4310c71b916568f04753f603fb24a0544227 commit\\trefs/namespaces/namespace/refs/tags/0\\n\" >> expected &&\n+\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/namespaces/namespace/refs/tags/1\\n\" >> expected &&\n+\t\ttest_cmp expected actual\n+\t)\n+'\n+\n+test_done\n-- \n1.7.5.4\n"},{"id":"171388","messageId":"7v1uxs3177.fsf@alter.siamese.dyndns.org","threadId":"27820","inReplyTo":"20110714205055.GA26956@leaf","subject":"Re: [PATCH] ref namespaces: tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-14T23:13:48Z","receivedAt":"2011-07-14T23:13:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josh Triplett <josh@joshtriplett.org> writes:\n\n> Test pushing, pulling, and mirroring of repositories with ref\n> namespaces.\n>\n> Signed-off-by: Josh Triplett <josh@joshtriplett.org>\n> Signed-off-by: Jamey Sharp <jamey@minilop.net>\n\nThanks.\n\n>  create mode 100755 t/t5502-fetch-push-namespaces.sh\n\nIsn't 5502 used already?\n\n> +test_expect_success setup '\n> +\ttest_tick &&\n> +\tgit init original &&\n> +\t(\n> +\t\tcd original &&\n> +\t\ti=0 &&\n> +\t\twhile [ \"$i\" -lt 2 ]\n> +\t\tdo\n> +\t\t\techo \"$i\" > count &&\n\nThis is just style, but the test scripts prefer to spell these like this:\n\n\twhile test \"$i\" -lt 2\n\tdo\n        \techo \"$i\" >count &&\n                ...\n\nto favor \"test\" over \"[ ... ]\", and omit SP between \">\" redirection (or\n\"<\" for that matter) and the filename.\n\n> +\t\tgit remote add pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n\nNice ;-).\n\n> +test_expect_success 'pushing into a repository using a ref namespace' '\n> +\t(\n> +\t\tcd original &&\n> +\t\tgit push pushee-namespaced master &&\n> +\t\tgit ls-remote pushee-namespaced > actual &&\n> +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba\\trefs/heads/master\\n\" > expected &&\n\nCould you avoid hardcoding the exact object names here?  Your script knows\nwhat object should appear at refs/heads/master at \"pushee-namespaced\" (as\nyou have pushed from the repository \"original\" you are in), so it may be\nsomething like:\n\n\tprintf \"%s\\trefs/heads/mater\\n\" $(git rev-parse master) >expect\n\nSame comment applies for all the other hardcoded object names.\n\n> +test_expect_success 'mirroring a repository using a ref namespace' '\n> +\tgit clone --mirror pushee mirror &&\n> +\t(\n> +\t\tcd mirror &&\n> +\t\tgit for-each-ref refs/ > actual &&\n> +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/namespaces/namespace/refs/heads/master\\n\" > expected &&\n> +\t\tprintf \"fbdf4310c71b916568f04753f603fb24a0544227 commit\\trefs/namespaces/namespace/refs/tags/0\\n\" >> expected &&\n> +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/namespaces/namespace/refs/tags/1\\n\" >> expected &&\n> +\t\ttest_cmp expected actual\n> +\t)\n> +'\n\nI am not sure what you are trying to test. \"pushee\" is pretending to be a\nhosting site that uses the namespace feature to house refs pushed from\noriginal in refs/namespaces/namespace/ so it is expected to have these\nrefs under there.  You didn't make any \"git remote\" configuration in\neither mirror nor pushee, so it is natural with or without the namespace\nfeature that \"git clone --mirror\" would find them at the same place.\n\nWhat hasn't been tested in the above is to see what actual refs pushee has\nwith (cd pushee && git for-each-ref), and you could argue that this test\nis a proxy for that, but then you are assuming that \"clone --mirror\" is\nnot broken, which means it would make debugging harder when this test does\nstart failing---is it the basic namespace feature, or is it mirror cloning\nthat acquired a bug to break this test?\n\nAlso I would have expected that some configuration that affects the\ncentral repository side (i.e. \"pushee\") to cause unsuspecting clients\n(e.g. \"original\" that pushes into it) to see only a subset of refs\n\"pushee\" has, which would be the real motivation for this feature. To show\nthat off, we may also need tests that house two or more namespaces hosted\nin the same repository.\n"},{"id":"171394","messageId":"20110715034538.GD28343@leaf","threadId":"27820","inReplyTo":"7v1uxs3177.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] ref namespaces: tests","fromName":"Josh Triplett","fromEmail":"josh@joshtriplett.org","sentAt":"2011-07-15T03:45:39Z","receivedAt":"2011-07-15T03:45:39Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"On Thu, Jul 14, 2011 at 04:13:48PM -0700, Junio C Hamano wrote:\n> Josh Triplett <josh@joshtriplett.org> writes:\n> >  create mode 100755 t/t5502-fetch-push-namespaces.sh\n> \n> Isn't 5502 used already?\n\nArgh.  Yes; I put it right after t5501-fetch-push-alternates.sh without\nnoticing that 5502 already existed.  I'll fix it to use t5507.  Thanks\nfor catching that.\n\n> > +test_expect_success setup '\n> > +\ttest_tick &&\n> > +\tgit init original &&\n> > +\t(\n> > +\t\tcd original &&\n> > +\t\ti=0 &&\n> > +\t\twhile [ \"$i\" -lt 2 ]\n> > +\t\tdo\n> > +\t\t\techo \"$i\" > count &&\n> \n> This is just style, but the test scripts prefer to spell these like this:\n> \n> \twhile test \"$i\" -lt 2\n> \tdo\n>         \techo \"$i\" >count &&\n>                 ...\n> \n> to favor \"test\" over \"[ ... ]\", and omit SP between \">\" redirection (or\n> \"<\" for that matter) and the filename.\n\nWill do.  I had done a quick grep-survey of the tests to check usage of\ntest versus [, and saw enough of both to assume it didn't matter, but it\nhadn't occurred to me to check CodingGuidelines for shell scripts; I now\nsee that it has a section specifically on shell scripting.  I'll fix\nthis in the next version.\n\nActually, I plan to unroll this two-iteration loop in the next version,\nso that I can capture the two object hashes I need for use later in the\nscript.\n\nOut of curiosity, what's the rationale for the use of test rather than\n'['?  Just uniformity, or does test have some particular advantage over\n'['?\n\n> > +\t\tgit remote add pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n> \n> Nice ;-).\n\nThanks. :)\n\n> > +test_expect_success 'pushing into a repository using a ref namespace' '\n> > +\t(\n> > +\t\tcd original &&\n> > +\t\tgit push pushee-namespaced master &&\n> > +\t\tgit ls-remote pushee-namespaced > actual &&\n> > +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba\\trefs/heads/master\\n\" > expected &&\n> \n> Could you avoid hardcoding the exact object names here?  Your script knows\n> what object should appear at refs/heads/master at \"pushee-namespaced\" (as\n> you have pushed from the repository \"original\" you are in), so it may be\n> something like:\n> \n> \tprintf \"%s\\trefs/heads/mater\\n\" $(git rev-parse master) >expect\n> \n> Same comment applies for all the other hardcoded object names.\n\nI can do that; since the same two object hashes recur throughout the\nscript, I'll record them in shell variables up at the top.\n\n> > +test_expect_success 'mirroring a repository using a ref namespace' '\n> > +\tgit clone --mirror pushee mirror &&\n> > +\t(\n> > +\t\tcd mirror &&\n> > +\t\tgit for-each-ref refs/ > actual &&\n> > +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/namespaces/namespace/refs/heads/master\\n\" > expected &&\n> > +\t\tprintf \"fbdf4310c71b916568f04753f603fb24a0544227 commit\\trefs/namespaces/namespace/refs/tags/0\\n\" >> expected &&\n> > +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba commit\\trefs/namespaces/namespace/refs/tags/1\\n\" >> expected &&\n> > +\t\ttest_cmp expected actual\n> > +\t)\n> > +'\n> \n> I am not sure what you are trying to test. \"pushee\" is pretending to be a\n> hosting site that uses the namespace feature to house refs pushed from\n> original in refs/namespaces/namespace/ so it is expected to have these\n> refs under there.  You didn't make any \"git remote\" configuration in\n> either mirror nor pushee, so it is natural with or without the namespace\n> feature that \"git clone --mirror\" would find them at the same place.\n> \n> What hasn't been tested in the above is to see what actual refs pushee has\n> with (cd pushee && git for-each-ref), and you could argue that this test\n> is a proxy for that, but then you are assuming that \"clone --mirror\" is\n> not broken, which means it would make debugging harder when this test does\n> start failing---is it the basic namespace feature, or is it mirror cloning\n> that acquired a bug to break this test?\n\nI wrote this test specifically to check for possible regressions in\nclone or the machinery underneath it.  I wanted to ensure that no future\nchange caused clone to ignore refs in refs/namespaces/*.  In particular,\nI want to protect against a regression caused by any future change to\nthe refs machinery that might cause it to ignore refs outside of\nrefs/heads/* or refs/tags/*, which might otherwise go un-noticed (as\nthey almost did during the development of this patchset, if not for an\nincidental side effect of t5501).\n\nIf this test failed, I would expect that it would fail because clone\n--mirror produced a mirrored repository which didn't actually contain\nany refs, even though pushee contained the correctly namespaced refs;\nthus, for-each-ref doesn't seem like the right test.\n\nMore generally, I also added this test because it tests a specific\nhigh-level feature I care about: the ability to mirror a repository\ncontaining namespaces using clone --mirror, and preserve those\nnamespaces.  I plan to use that as a backup mechanism, and I want it to\ncontinue working. :)\n\n- Josh Triplett\n"},{"id":"171413","messageId":"20110715184045.GA2232@leaf","threadId":"27820","inReplyTo":"20110715034538.GD28343@leaf","subject":"[PATCHv2] ref namespaces: tests","fromName":"Josh Triplett","fromEmail":"josh@joshtriplett.org","sentAt":"2011-07-15T18:40:45Z","receivedAt":"2011-07-15T18:40:45Z","isPatch":false,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"Test pushing, pulling, and mirroring of repositories with ref\nnamespaces.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n\nv2: Incorporate feedback from Junio: change test number to 5507 to avoid\nconflicting with existing tests, make style consistent with other test\nscripts, avoid hardcoding commit hashes, add rationale for mirror test.\n\n t/t5507-fetch-push-namespaces.sh |   85 ++++++++++++++++++++++++++++++++++++++\n 1 files changed, 85 insertions(+), 0 deletions(-)\n create mode 100755 t/t5507-fetch-push-namespaces.sh\n\ndiff --git a/t/t5507-fetch-push-namespaces.sh b/t/t5507-fetch-push-namespaces.sh\nnew file mode 100755\nindex 0000000..cc0b31f\n--- /dev/null\n+++ b/t/t5507-fetch-push-namespaces.sh\n@@ -0,0 +1,85 @@\n+#!/bin/sh\n+\n+test_description='fetch/push involving ref namespaces'\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\ttest_tick &&\n+\tgit init original &&\n+\t(\n+\t\tcd original &&\n+\t\techo 0 >count &&\n+\t\tgit add count &&\n+\t\ttest_commit 0 &&\n+\t\techo 1 >count &&\n+\t\tgit add count &&\n+\t\ttest_commit 1 &&\n+\t\tgit remote add pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n+\t\tgit remote add pushee-unnamespaced ../pushee\n+\t) &&\n+\tcommit0=$(cd original && git rev-parse HEAD^) &&\n+\tcommit1=$(cd original && git rev-parse HEAD) &&\n+\tgit init pushee &&\n+\tgit init puller\n+'\n+\n+test_expect_success 'pushing into a repository using a ref namespace' '\n+\t(\n+\t\tcd original &&\n+\t\tgit push pushee-namespaced master &&\n+\t\tgit ls-remote pushee-namespaced >actual &&\n+\t\tprintf \"$commit1\\trefs/heads/master\\n\" >expected &&\n+\t\ttest_cmp expected actual &&\n+\t\tgit push pushee-namespaced --tags &&\n+\t\tgit ls-remote pushee-namespaced >actual &&\n+\t\tprintf \"$commit0\\trefs/tags/0\\n\" >>expected &&\n+\t\tprintf \"$commit1\\trefs/tags/1\\n\" >>expected &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Verify that the GIT_NAMESPACE environment variable works as well\n+\t\tGIT_NAMESPACE=namespace git ls-remote \"ext::git %s ../pushee\" >actual &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Verify that --namespace overrides GIT_NAMESPACE\n+\t\tGIT_NAMESPACE=garbage git ls-remote pushee-namespaced >actual &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Try a namespace with no content\n+\t\tgit ls-remote \"ext::git --namespace=garbage %s ../pushee\" >actual &&\n+\t\ttest_cmp /dev/null actual &&\n+\t\tgit ls-remote pushee-unnamespaced >actual &&\n+\t\tsed -e \"s|refs/|refs/namespaces/namespace/refs/|\" expected >expected.unnamespaced &&\n+\t\ttest_cmp expected.unnamespaced actual\n+\t)\n+'\n+\n+test_expect_success 'pulling from a repository using a ref namespace' '\n+\t(\n+\t\tcd puller &&\n+\t\tgit remote add -f pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n+\t\tgit for-each-ref refs/ >actual &&\n+\t\tprintf \"$commit1 commit\\trefs/remotes/pushee-namespaced/master\\n\" >expected &&\n+\t\tprintf \"$commit0 commit\\trefs/tags/0\\n\" >>expected &&\n+\t\tprintf \"$commit1 commit\\trefs/tags/1\\n\" >>expected &&\n+\t\ttest_cmp expected actual\n+\t)\n+'\n+\n+# This test with clone --mirror checks for possible regressions in clone\n+# or the machinery underneath it. It ensures that no future change\n+# causes clone to ignore refs in refs/namespaces/*. In particular, it\n+# protects against a regression caused by any future change to the refs\n+# machinery that might cause it to ignore refs outside of refs/heads/*\n+# or refs/tags/*. More generally, this test also checks the high-level\n+# functionality of using clone --mirror to back up a set of repos hosted\n+# in the namespaces of a single repo.\n+test_expect_success 'mirroring a repository using a ref namespace' '\n+\tgit clone --mirror pushee mirror &&\n+\t(\n+\t\tcd mirror &&\n+\t\tgit for-each-ref refs/ >actual &&\n+\t\tprintf \"$commit1 commit\\trefs/namespaces/namespace/refs/heads/master\\n\" >expected &&\n+\t\tprintf \"$commit0 commit\\trefs/namespaces/namespace/refs/tags/0\\n\" >>expected &&\n+\t\tprintf \"$commit1 commit\\trefs/namespaces/namespace/refs/tags/1\\n\" >>expected &&\n+\t\ttest_cmp expected actual\n+\t)\n+'\n+\n+test_done\n-- \n1.7.5.4\n"},{"id":"171423","messageId":"7vhb6n1gjd.fsf@alter.siamese.dyndns.org","threadId":"27820","inReplyTo":"7v1uxs3177.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] ref namespaces: tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-15T19:37:42Z","receivedAt":"2011-07-15T19:37:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> +test_expect_success 'pushing into a repository using a ref namespace' '\n>> +\t(\n>> +\t\tcd original &&\n>> +\t\tgit push pushee-namespaced master &&\n>> +\t\tgit ls-remote pushee-namespaced > actual &&\n>> +\t\tprintf \"dc65a2e0f299dcc7efddbbe01641a28ee84329ba\\trefs/heads/master\\n\" > expected &&\n>\n> Could you avoid hardcoding the exact object names here?  Your script knows\n> what object should appear at refs/heads/master at \"pushee-namespaced\" (as\n> you have pushed from the repository \"original\" you are in), so it may be\n> something like:\n>\n> \tprintf \"%s\\trefs/heads/mater\\n\" $(git rev-parse master) >expect\n>\n> Same comment applies for all the other hardcoded object names.\n\nJust FYI, I did a sample fix-up for earlier tests in this patch and pushed\nit out in 'pu'; hopefully it may save your time.\n\nThanks.\n"},{"id":"171815","messageId":"20110721201054.GA2530@leaf","threadId":"27820","inReplyTo":"20110715184045.GA2232@leaf","subject":"[PATCHv3] ref namespaces: tests","fromName":"Josh Triplett","fromEmail":"josh@joshtriplett.org","sentAt":"2011-07-21T20:10:54Z","receivedAt":"2011-07-21T20:10:54Z","isPatch":false,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"Test pushing, pulling, and mirroring of repositories with ref\nnamespaces.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n\nv3: Change test number to 5509 to avoid conflicts with new tests 5507\nand 5508 in pu.\n\nAt this point I think we've incorporated all the outstanding feedback.\nDoes this test need any further changes to allow the ref-namespaces\nbranch to graduate to next?\n\n(Also, for future reference, do you prefer to see later versions of\npatches as replies to the previous version, as I've made this mail a\nreply to PATCHv2, or do you prefer to see them as new threads?)\n\nv2: Incorporate feedback from Junio: change test number to 5507 to avoid\nconflicting with existing tests, make style consistent with other test\nscripts, avoid hardcoding commit hashes, add rationale for mirror test.\n\n t/t5509-fetch-push-namespaces.sh |   85 ++++++++++++++++++++++++++++++++++++++\n 1 files changed, 85 insertions(+), 0 deletions(-)\n create mode 100755 t/t5509-fetch-push-namespaces.sh\n\ndiff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh\nnew file mode 100755\nindex 0000000..cc0b31f\n--- /dev/null\n+++ b/t/t5509-fetch-push-namespaces.sh\n@@ -0,0 +1,85 @@\n+#!/bin/sh\n+\n+test_description='fetch/push involving ref namespaces'\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\ttest_tick &&\n+\tgit init original &&\n+\t(\n+\t\tcd original &&\n+\t\techo 0 >count &&\n+\t\tgit add count &&\n+\t\ttest_commit 0 &&\n+\t\techo 1 >count &&\n+\t\tgit add count &&\n+\t\ttest_commit 1 &&\n+\t\tgit remote add pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n+\t\tgit remote add pushee-unnamespaced ../pushee\n+\t) &&\n+\tcommit0=$(cd original && git rev-parse HEAD^) &&\n+\tcommit1=$(cd original && git rev-parse HEAD) &&\n+\tgit init pushee &&\n+\tgit init puller\n+'\n+\n+test_expect_success 'pushing into a repository using a ref namespace' '\n+\t(\n+\t\tcd original &&\n+\t\tgit push pushee-namespaced master &&\n+\t\tgit ls-remote pushee-namespaced >actual &&\n+\t\tprintf \"$commit1\\trefs/heads/master\\n\" >expected &&\n+\t\ttest_cmp expected actual &&\n+\t\tgit push pushee-namespaced --tags &&\n+\t\tgit ls-remote pushee-namespaced >actual &&\n+\t\tprintf \"$commit0\\trefs/tags/0\\n\" >>expected &&\n+\t\tprintf \"$commit1\\trefs/tags/1\\n\" >>expected &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Verify that the GIT_NAMESPACE environment variable works as well\n+\t\tGIT_NAMESPACE=namespace git ls-remote \"ext::git %s ../pushee\" >actual &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Verify that --namespace overrides GIT_NAMESPACE\n+\t\tGIT_NAMESPACE=garbage git ls-remote pushee-namespaced >actual &&\n+\t\ttest_cmp expected actual &&\n+\t\t# Try a namespace with no content\n+\t\tgit ls-remote \"ext::git --namespace=garbage %s ../pushee\" >actual &&\n+\t\ttest_cmp /dev/null actual &&\n+\t\tgit ls-remote pushee-unnamespaced >actual &&\n+\t\tsed -e \"s|refs/|refs/namespaces/namespace/refs/|\" expected >expected.unnamespaced &&\n+\t\ttest_cmp expected.unnamespaced actual\n+\t)\n+'\n+\n+test_expect_success 'pulling from a repository using a ref namespace' '\n+\t(\n+\t\tcd puller &&\n+\t\tgit remote add -f pushee-namespaced \"ext::git --namespace=namespace %s ../pushee\" &&\n+\t\tgit for-each-ref refs/ >actual &&\n+\t\tprintf \"$commit1 commit\\trefs/remotes/pushee-namespaced/master\\n\" >expected &&\n+\t\tprintf \"$commit0 commit\\trefs/tags/0\\n\" >>expected &&\n+\t\tprintf \"$commit1 commit\\trefs/tags/1\\n\" >>expected &&\n+\t\ttest_cmp expected actual\n+\t)\n+'\n+\n+# This test with clone --mirror checks for possible regressions in clone\n+# or the machinery underneath it. It ensures that no future change\n+# causes clone to ignore refs in refs/namespaces/*. In particular, it\n+# protects against a regression caused by any future change to the refs\n+# machinery that might cause it to ignore refs outside of refs/heads/*\n+# or refs/tags/*. More generally, this test also checks the high-level\n+# functionality of using clone --mirror to back up a set of repos hosted\n+# in the namespaces of a single repo.\n+test_expect_success 'mirroring a repository using a ref namespace' '\n+\tgit clone --mirror pushee mirror &&\n+\t(\n+\t\tcd mirror &&\n+\t\tgit for-each-ref refs/ >actual &&\n+\t\tprintf \"$commit1 commit\\trefs/namespaces/namespace/refs/heads/master\\n\" >expected &&\n+\t\tprintf \"$commit0 commit\\trefs/namespaces/namespace/refs/tags/0\\n\" >>expected &&\n+\t\tprintf \"$commit1 commit\\trefs/namespaces/namespace/refs/tags/1\\n\" >>expected &&\n+\t\ttest_cmp expected actual\n+\t)\n+'\n+\n+test_done\n-- \n1.7.5.4\n"},{"id":"171869","messageId":"7v62mux9ae.fsf@alter.siamese.dyndns.org","threadId":"27820","inReplyTo":"20110721201054.GA2530@leaf","subject":"Re: [PATCHv3] ref namespaces: tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-21T21:56:16Z","receivedAt":"2011-07-21T21:56:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josh Triplett <josh@joshtriplett.org> writes:\n\n> At this point I think we've incorporated all the outstanding feedback.\n> Does this test need any further changes to allow the ref-namespaces\n> branch to graduate to next?\n\nNo more nitpicks from me on this patch at least for now.\n\nAre people who expressed concern during the review on the previous round\nof the series happy with the second round? I recall there was a strong\nsentiment that it is regrettable that the series specifically changes\nfetch and push and is not a more general mechanism. Personally I am OK\nwith the approach taken by this series, as I do not offhand think of other\nways to serve a modified namespace. You have to view the unaltered reality\nwhen interacting with your own refs to enumerate the objects you have,\nwhile giving the altered view to your clients that is limited to the\n\"virtual\" space.\n\n> (Also, for future reference, do you prefer to see later versions of\n> patches as replies to the previous version, as I've made this mail a\n> reply to PATCHv2, or do you prefer to see them as new threads?)\n\nOften it is very convenient to be able to go \"up\" in the thread to re-read\nthe discussions in the previous round. On the other hand it sometimes gets\ninconvenient when viewing tons of threads to have a beginning of a new\nround buried deep in other threads. Referring to the messages in the\nprevious round by their message-id (or thread.gmane.org/ URL) in the body\nof the patch message below \"---\" lines may solve both issues, but I can go\neither way.\n"},{"id":"171874","messageId":"20110722223211.GA19620@sigill.intra.peff.net","threadId":"27820","inReplyTo":"7v62mux9ae.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv3] ref namespaces: tests","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-07-22T22:32:13Z","receivedAt":"2011-07-22T22:32:13Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 21, 2011 at 02:56:16PM -0700, Junio C Hamano wrote:\n\n> Josh Triplett <josh@joshtriplett.org> writes:\n> \n> > At this point I think we've incorporated all the outstanding feedback.\n> > Does this test need any further changes to allow the ref-namespaces\n> > branch to graduate to next?\n> \n> No more nitpicks from me on this patch at least for now.\n> \n> Are people who expressed concern during the review on the previous round\n> of the series happy with the second round? I recall there was a strong\n> sentiment that it is regrettable that the series specifically changes\n> fetch and push and is not a more general mechanism. Personally I am OK\n> with the approach taken by this series, as I do not offhand think of other\n> ways to serve a modified namespace. You have to view the unaltered reality\n> when interacting with your own refs to enumerate the objects you have,\n> while giving the altered view to your clients that is limited to the\n> \"virtual\" space.\n\nI was one of the people who wanted to have namespaces or virtual repos\nat a more fundamental level. However, I tried to do a relatively simple\npatch when the discussion started, and ended up getting mired in corner\ncases. And it sounds like Josh and Jamey made a good faith effort in\nthat direction, but still ended up where they are now. So I'm willing to\naccept that it is not as simple as we hoped, and the more practical\napproach from their series is acceptable.\n\nAs for the code itself, I admit I haven't been paying all that close\nattention. I can try to give a more careful review if we want another\nset of eyes.\n\n-Peff\n"}]}