{"thread":{"id":"10378","subject":"[PATCH] send-pack: respect '+' on wildcard refspecs","startedAt":"2007-10-19T09:04:00Z","lastAt":"2007-10-20T04:57:33Z","messageCount":10,"participants":["Jeff King","Dan McGee","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"56548","messageId":"20071019090400.GA8944@coredump.intra.peff.net","threadId":"10378","inReplyTo":null,"subject":"[PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-19T09:04:00Z","receivedAt":"2007-10-19T09:04:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When matching source and destination refs, we were failing\nto pull the 'force' parameter from wildcard respects (but\nnot explicit ones) and attach it to the ref struct.\n\nThis adds a test for explicit and wildcard refspecs; the\nlatter fails without this patch.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n remote.c             |    2 ++\n t/t5400-send-pack.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 50 insertions(+), 0 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex b20e2be..170015a 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -762,6 +762,8 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,\n \t\t\thashcpy(dst_peer->new_sha1, src->new_sha1);\n \t\t}\n \t\tdst_peer->peer_ref = src;\n+\t\tif (pat)\n+\t\t\tdst_peer->force = pat->force;\n \tfree_name:\n \t\tfree(dst_name);\n \t}\ndiff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh\nindex 57c6397..2d0c07f 100755\n--- a/t/t5400-send-pack.sh\n+++ b/t/t5400-send-pack.sh\n@@ -123,4 +123,52 @@ test_expect_success \\\n \tgit-branch -a >branches && ! grep -q origin/master branches\n '\n \n+rewound_push_setup() {\n+\trm -rf parent child &&\n+\tmkdir parent && cd parent &&\n+\tgit-init && echo one >file && git-add file && git-commit -m one &&\n+\techo two >file && git-commit -a -m two &&\n+\tcd .. &&\n+\tgit-clone parent child && cd child && git-reset --hard HEAD^\n+}\n+\n+rewound_push_succeeded() {\n+\tcmp ../parent/.git/refs/heads/master .git/refs/heads/master\n+}\n+\n+rewound_push_failed() {\n+\tif rewound_push_succeeded\n+\tthen\n+\t\tfalse\n+\telse\n+\t\ttrue\n+\tfi\n+}\n+\n+test_expect_success \\\n+\t'pushing explicit refspecs respects forcing' '\n+\trewound_push_setup &&\n+\tif git-send-pack ../parent/.git refs/heads/master:refs/heads/master\n+\tthen\n+\t\tfalse\n+\telse\n+\t\ttrue\n+\tfi && rewound_push_failed &&\n+\tgit-send-pack ../parent/.git +refs/heads/master:refs/heads/master &&\n+\trewound_push_succeeded\n+'\n+\n+test_expect_success \\\n+\t'pushing wildcard refspecs respects forcing' '\n+\trewound_push_setup &&\n+\tif git-send-pack ../parent/.git refs/heads/*:refs/heads/*\n+\tthen\n+\t\tfalse\n+\telse\n+\t\ttrue\n+\tfi && rewound_push_failed &&\n+\tgit-send-pack ../parent/.git +refs/heads/*:refs/heads/* &&\n+\trewound_push_succeeded\n+'\n+\n test_done\n-- \n1.5.3.4.1254.gc1ca9-dirty\n"},{"id":"56549","messageId":"20071019090451.GA9037@coredump.intra.peff.net","threadId":"10378","inReplyTo":"20071019090400.GA8944@coredump.intra.peff.net","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-19T09:04:51Z","receivedAt":"2007-10-19T09:04:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 19, 2007 at 05:04:00AM -0400, Jeff King wrote:\n\n> to pull the 'force' parameter from wildcard respects (but\n\nUrgh, that should be \"refspecs\", not \"respects\". Maybe I should quit for\nthe night.\n\n-Peff\n"},{"id":"56563","messageId":"449c10960710190510y3af3ffa2ydb9ae4a01b5d480c@mail.gmail.com","threadId":"10378","inReplyTo":"20071019090400.GA8944@coredump.intra.peff.net","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Dan McGee","fromEmail":"dan@archlinux.org","sentAt":"2007-10-19T12:10:42Z","receivedAt":"2007-10-19T12:10:42Z","isPatch":true,"sender":{"key":"dan@archlinux.org","avatar":null},"body":"On 10/19/07, Jeff King <peff@peff.net> wrote:\n> When matching source and destination refs, we were failing\n> to pull the 'force' parameter from wildcard respects (but\n> not explicit ones) and attach it to the ref struct.\n>\n> This adds a test for explicit and wildcard refspecs; the\n> latter fails without this patch.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  remote.c             |    2 ++\n>  t/t5400-send-pack.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 50 insertions(+), 0 deletions(-)\n>\n> diff --git a/remote.c b/remote.c\n> index b20e2be..170015a 100644\n> --- a/remote.c\n> +++ b/remote.c\n> @@ -762,6 +762,8 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,\n>                         hashcpy(dst_peer->new_sha1, src->new_sha1);\n>                 }\n>                 dst_peer->peer_ref = src;\n> +               if (pat)\n> +                       dst_peer->force = pat->force;\n>         free_name:\n>                 free(dst_name);\n>         }\n> diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh\n> index 57c6397..2d0c07f 100755\n> --- a/t/t5400-send-pack.sh\n> +++ b/t/t5400-send-pack.sh\n> @@ -123,4 +123,52 @@ test_expect_success \\\n>         git-branch -a >branches && ! grep -q origin/master branches\n>  '\n>\n> +rewound_push_setup() {\n> +       rm -rf parent child &&\n> +       mkdir parent && cd parent &&\n> +       git-init && echo one >file && git-add file && git-commit -m one &&\n> +       echo two >file && git-commit -a -m two &&\n> +       cd .. &&\n> +       git-clone parent child && cd child && git-reset --hard HEAD^\n> +}\n> +\n> +rewound_push_succeeded() {\n> +       cmp ../parent/.git/refs/heads/master .git/refs/heads/master\n> +}\n> +\n> +rewound_push_failed() {\n> +       if rewound_push_succeeded\n> +       then\n> +               false\n> +       else\n> +               true\n> +       fi\n> +}\n> +\n> +test_expect_success \\\n> +       'pushing explicit refspecs respects forcing' '\n> +       rewound_push_setup &&\n> +       if git-send-pack ../parent/.git refs/heads/master:refs/heads/master\n> +       then\n> +               false\n> +       else\n> +               true\n> +       fi && rewound_push_failed &&\n> +       git-send-pack ../parent/.git +refs/heads/master:refs/heads/master &&\n> +       rewound_push_succeeded\n> +'\n> +\n> +test_expect_success \\\n> +       'pushing wildcard refspecs respects forcing' '\n> +       rewound_push_setup &&\n> +       if git-send-pack ../parent/.git refs/heads/*:refs/heads/*\n> +       then\n> +               false\n> +       else\n> +               true\n> +       fi && rewound_push_failed &&\n> +       git-send-pack ../parent/.git +refs/heads/*:refs/heads/* &&\n> +       rewound_push_succeeded\n> +'\n> +\n>  test_done\n> --\n> 1.5.3.4.1254.gc1ca9-dirty\n>\n\nHmm. For some reason this passes with your test case, but not with my\noriginal bash test script[1]. Did you try it with this?\n\n-Dan\n\n[1] http://www.toofishes.net/uploads/\n"},{"id":"56565","messageId":"20071019122755.GA17002@coredump.intra.peff.net","threadId":"10378","inReplyTo":"449c10960710190510y3af3ffa2ydb9ae4a01b5d480c@mail.gmail.com","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-19T12:27:56Z","receivedAt":"2007-10-19T12:27:56Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 19, 2007 at 07:10:42AM -0500, Dan McGee wrote:\n\n> Hmm. For some reason this passes with your test case, but not with my\n> original bash test script[1]. Did you try it with this?\n>\n> [1] http://www.toofishes.net/uploads/\n\n[please trim quoted text; I had a hard time finding your message amidst\nthe patch]\n\nI didn't try it until you sent your message, but your test seems to work\nfine for me. My patch is on top of 'next', which is what I usually run.\nI haven't looked into 'master' (I assumed since the bug was reproducible\nin both, it would be the same in both, but that is perhaps not the\ncase).\n\n-Peff\n"},{"id":"56576","messageId":"449c10960710190638j5823b19dl903ae369965e884e@mail.gmail.com","threadId":"10378","inReplyTo":"20071019122755.GA17002@coredump.intra.peff.net","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Dan McGee","fromEmail":"dan@archlinux.org","sentAt":"2007-10-19T13:38:06Z","receivedAt":"2007-10-19T13:38:06Z","isPatch":true,"sender":{"key":"dan@archlinux.org","avatar":null},"body":"On 10/19/07, Jeff King <peff@peff.net> wrote:\n> On Fri, Oct 19, 2007 at 07:10:42AM -0500, Dan McGee wrote:\n>\n> > Hmm. For some reason this passes with your test case, but not with my\n> > original bash test script[1]. Did you try it with this?\n> >\n> > [1] http://www.toofishes.net/uploads/\n>\n> I didn't try it until you sent your message, but your test seems to work\n> fine for me. My patch is on top of 'next', which is what I usually run.\n> I haven't looked into 'master' (I assumed since the bug was reproducible\n> in both, it would be the same in both, but that is perhaps not the\n> case).\n\nStill getting this error:\nerror: remote 'refs/heads/working' is not a strict subset of local ref\n'refs/heads/working'. maybe you are not up-to-date and need to pull\nfirst?\nerror: failed to push to '/tmp/testpush'\n\nI've tried applying the patch on the following commits, and maybe I'm\nsmoking something but I can't get it to pass my test script.\n\norigin(junio)/master: 58ba4f6\norigin(junio)/next: fe96ee67ec5840\nspearce/master: 7840ce6cb24a9d\nspearce/next: 2fe5433b416f0df\n\nCan you let me know what commit you based the patch off of? I'm at\nwork for the next 8 hours or so, so I can't look in to this a whole\nlot until tonight.\n\n-Dan\n"},{"id":"56578","messageId":"20071019134339.GA21852@coredump.intra.peff.net","threadId":"10378","inReplyTo":"449c10960710190638j5823b19dl903ae369965e884e@mail.gmail.com","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-19T13:43:39Z","receivedAt":"2007-10-19T13:43:39Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 19, 2007 at 08:38:06AM -0500, Dan McGee wrote:\n\n> origin(junio)/master: 58ba4f6\n> origin(junio)/next: fe96ee67ec5840\n> spearce/master: 7840ce6cb24a9d\n> spearce/next: 2fe5433b416f0df\n> \n> Can you let me know what commit you based the patch off of? I'm at\n> work for the next 8 hours or so, so I can't look in to this a whole\n> lot until tonight.\n\nIt is based on Shawn's next, 2fe5433b. Are you sure you're not doing\nsomething silly like executing an older version of git that is in your\nPATH?\n\n-Peff\n"},{"id":"56581","messageId":"449c10960710190711p712e780dl5bb322d0804e4ecc@mail.gmail.com","threadId":"10378","inReplyTo":"20071019134339.GA21852@coredump.intra.peff.net","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Dan McGee","fromEmail":"dan@archlinux.org","sentAt":"2007-10-19T14:11:00Z","receivedAt":"2007-10-19T14:11:00Z","isPatch":true,"sender":{"key":"dan@archlinux.org","avatar":null},"body":"Ahh, shoot. Forgot to reply to all.\n\nOn 10/19/07, Jeff King <peff@peff.net> wrote:\n> It is based on Shawn's next, 2fe5433b. Are you sure you're not doing\n> something silly like executing an older version of git that is in your\n> PATH?\n\nYeah, just tried that again, definitely using the right version of\ngit. Before I apply your patch, both my test script and your addition\nto t5400 fail. After applying your patch, my test script fails but\nyour addition to t5400 succeeds. Could this be something where\ngit-push and git-send-pack are not interacting correctly?\n\n-Dan\n"},{"id":"56645","messageId":"449c10960710191800j3e61b80cma2c582080c1dd07c@mail.gmail.com","threadId":"10378","inReplyTo":"20071019134339.GA21852@coredump.intra.peff.net","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Dan McGee","fromEmail":"dan@archlinux.org","sentAt":"2007-10-20T01:00:37Z","receivedAt":"2007-10-20T01:00:37Z","isPatch":true,"sender":{"key":"dan@archlinux.org","avatar":null},"body":"On 10/19/07, Jeff King <peff@peff.net> wrote:\n> On Fri, Oct 19, 2007 at 08:38:06AM -0500, Dan McGee wrote:\n>\n> > origin(junio)/master: 58ba4f6\n> > origin(junio)/next: fe96ee67ec5840\n> > spearce/master: 7840ce6cb24a9d\n> > spearce/next: 2fe5433b416f0df\n> >\n> > Can you let me know what commit you based the patch off of? I'm at\n> > work for the next 8 hours or so, so I can't look in to this a whole\n> > lot until tonight.\n>\n> It is based on Shawn's next, 2fe5433b. Are you sure you're not doing\n> something silly like executing an older version of git that is in your\n> PATH?\n\nTurns out I didn't have GIT_EXEC_PATH set up right. Once I do that,\neverything seems to work just fine.\n\nThanks for looking into this Jeff, and git-bisect just won me over. It\nmade easy work of finding the commit that broke this.\n\n-Dan\n"},{"id":"56649","messageId":"20071020042257.GA26755@coredump.intra.peff.net","threadId":"10378","inReplyTo":"449c10960710191800j3e61b80cma2c582080c1dd07c@mail.gmail.com","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-20T04:22:57Z","receivedAt":"2007-10-20T04:22:57Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 19, 2007 at 08:00:37PM -0500, Dan McGee wrote:\n\n> Turns out I didn't have GIT_EXEC_PATH set up right. Once I do that,\n> everything seems to work just fine.\n> \n> Thanks for looking into this Jeff, and git-bisect just won me over. It\n> made easy work of finding the commit that broke this.\n\nHuzzah, success! Shawn, this should probably go on 'maint'. Although it\nis probably not high priority (it has been broken since May; I think\nwildcard push refspecs must not be that common), it is a fairly trivial\nfix that shouldn't impact anyone else.\n\n-Peff\n"},{"id":"56652","messageId":"20071020045733.GS14735@spearce.org","threadId":"10378","inReplyTo":"20071020042257.GA26755@coredump.intra.peff.net","subject":"Re: [PATCH] send-pack: respect '+' on wildcard refspecs","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-20T04:57:33Z","receivedAt":"2007-10-20T04:57:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jeff King <peff@peff.net> wrote:\n> On Fri, Oct 19, 2007 at 08:00:37PM -0500, Dan McGee wrote:\n> \n> > Turns out I didn't have GIT_EXEC_PATH set up right. Once I do that,\n> > everything seems to work just fine.\n> > \n> > Thanks for looking into this Jeff, and git-bisect just won me over. It\n> > made easy work of finding the commit that broke this.\n> \n> Huzzah, success! Shawn, this should probably go on 'maint'. Although it\n> is probably not high priority (it has been broken since May; I think\n> wildcard push refspecs must not be that common), it is a fairly trivial\n> fix that shouldn't impact anyone else.\n\nYea, its already queued on maint.  Both the patch and the\ntests are obviously correct.  Its broken without the patch.\nIts documented/expected behavior fixed by the patch.  IMHO it\nbelongs in maint.\n\n-- \nShawn.\n"}]}