git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dan McGee" <dan@archlinux.org>
To: "Jeff King" <peff@peff.net>
Cc: "Shawn O. Pearce" <spearce@spearce.org>, git@vger.kernel.org
Subject: Re: [PATCH] send-pack: respect '+' on wildcard refspecs
Date: Fri, 19 Oct 2007 07:10:42 -0500	[thread overview]
Message-ID: <449c10960710190510y3af3ffa2ydb9ae4a01b5d480c@mail.gmail.com> (raw)
In-Reply-To: <20071019090400.GA8944@coredump.intra.peff.net>

On 10/19/07, Jeff King <peff@peff.net> wrote:
> When matching source and destination refs, we were failing
> to pull the 'force' parameter from wildcard respects (but
> not explicit ones) and attach it to the ref struct.
>
> This adds a test for explicit and wildcard refspecs; the
> latter fails without this patch.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  remote.c             |    2 ++
>  t/t5400-send-pack.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+), 0 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index b20e2be..170015a 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -762,6 +762,8 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
>                         hashcpy(dst_peer->new_sha1, src->new_sha1);
>                 }
>                 dst_peer->peer_ref = src;
> +               if (pat)
> +                       dst_peer->force = pat->force;
>         free_name:
>                 free(dst_name);
>         }
> diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
> index 57c6397..2d0c07f 100755
> --- a/t/t5400-send-pack.sh
> +++ b/t/t5400-send-pack.sh
> @@ -123,4 +123,52 @@ test_expect_success \
>         git-branch -a >branches && ! grep -q origin/master branches
>  '
>
> +rewound_push_setup() {
> +       rm -rf parent child &&
> +       mkdir parent && cd parent &&
> +       git-init && echo one >file && git-add file && git-commit -m one &&
> +       echo two >file && git-commit -a -m two &&
> +       cd .. &&
> +       git-clone parent child && cd child && git-reset --hard HEAD^
> +}
> +
> +rewound_push_succeeded() {
> +       cmp ../parent/.git/refs/heads/master .git/refs/heads/master
> +}
> +
> +rewound_push_failed() {
> +       if rewound_push_succeeded
> +       then
> +               false
> +       else
> +               true
> +       fi
> +}
> +
> +test_expect_success \
> +       'pushing explicit refspecs respects forcing' '
> +       rewound_push_setup &&
> +       if git-send-pack ../parent/.git refs/heads/master:refs/heads/master
> +       then
> +               false
> +       else
> +               true
> +       fi && rewound_push_failed &&
> +       git-send-pack ../parent/.git +refs/heads/master:refs/heads/master &&
> +       rewound_push_succeeded
> +'
> +
> +test_expect_success \
> +       'pushing wildcard refspecs respects forcing' '
> +       rewound_push_setup &&
> +       if git-send-pack ../parent/.git refs/heads/*:refs/heads/*
> +       then
> +               false
> +       else
> +               true
> +       fi && rewound_push_failed &&
> +       git-send-pack ../parent/.git +refs/heads/*:refs/heads/* &&
> +       rewound_push_succeeded
> +'
> +
>  test_done
> --
> 1.5.3.4.1254.gc1ca9-dirty
>

Hmm. For some reason this passes with your test case, but not with my
original bash test script[1]. Did you try it with this?

-Dan

[1] http://www.toofishes.net/uploads/

  parent reply	other threads:[~2007-10-19 12:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19  9:04 [PATCH] send-pack: respect '+' on wildcard refspecs Jeff King
2007-10-19  9:04 ` Jeff King
2007-10-19 12:10 ` Dan McGee [this message]
2007-10-19 12:27   ` Jeff King
2007-10-19 13:38     ` Dan McGee
2007-10-19 13:43       ` Jeff King
2007-10-19 14:11         ` Dan McGee
2007-10-20  1:00         ` Dan McGee
2007-10-20  4:22           ` Jeff King
2007-10-20  4:57             ` Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=449c10960710190510y3af3ffa2ydb9ae4a01b5d480c@mail.gmail.com \
    --to=dan@archlinux.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).