git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	Git mailing list <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Subject: Re: [RFC v2 1/1] refspec: add support for negative refspecs
Date: Mon, 24 Aug 2020 08:47:54 -0700	[thread overview]
Message-ID: <CA+P7+xp9CEO_wLbqvg26cTWV45mniMwJyJkY8xEmMTqLOWjoSw@mail.gmail.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2008221528170.56@tvgsbejvaqbjf.bet>

On Sun, Aug 23, 2020 at 1:29 PM Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> Hi Jake,
>
> On Fri, 21 Aug 2020, Jacob Keller wrote:
>
> >  static void query_refspecs_multiple(struct refspec *rs,
> >                                   struct refspec_item *query,
> >                                   struct string_list *results)
> >  {
> > -     int i;
> > +     int i, matched_negative = 0;
> >       int find_src = !query->src;
> > +     struct string_list reversed = STRING_LIST_INIT_NODUP;
> > +     const char *needle = find_src ? query->dst : query->src;
> > +     char **result = find_src ? &query->src : &query->dst;
> >
> >       if (find_src && !query->dst)
> >               BUG("query_refspecs_multiple: need either src or dst");
> >
> > +     /*
> > +      * If a ref matches any of the negative refspecs, then we should treat
> > +      * it as not matching this query. Note that negative refspecs apply to
> > +      * the source but we're checking only the destination. Reverse and
> > +      * capture any pattern refspecs in order to see if the source would
> > +      * have matched a negative refspec.
> > +      */
> > +     for (i = 0; i < rs->nr; i++) {
> > +             struct refspec_item *refspec = &rs->items[i];
> > +             char *expn_name;
> > +
> > +             if (refspec->negative)
> > +                     continue;
> > +
> > +             /* Note the reversal of src and dst */
> > +             if (refspec->pattern) {
> > +                     const char *key = refspec->dst ?: refspec->src;
>
> This breaks at least with Visual C. I need this to unbreak the build:
>


The provided fixup! looks good to me. I'll pull it in when making the
next revision.

Thanks,
Jake

> -- snipsnap --
> Subject: [PATCH] fixup! refspec: add support for negative refspecs
>
> The `?:` operator is not supported e.g. by Visual C. Let's not use it.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  remote.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index 940622e0ba88..8e081863c06d 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -731,7 +731,7 @@ static void query_refspecs_multiple(struct refspec *rs,
>
>                 /* Note the reversal of src and dst */
>                 if (refspec->pattern) {
> -                       const char *key = refspec->dst ?: refspec->src;
> +                       const char *key = refspec->dst ? refspec->dst : refspec->src;
>                         const char *value = refspec->src;
>
>                         if (match_name_with_pattern(key, needle, value, &expn_name))
> @@ -795,7 +795,7 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
>
>                 /* Note the reversal of src and dst */
>                 if (refspec->pattern) {
> -                       const char *key = refspec->dst ?: refspec->src;
> +                       const char *key = refspec->dst ? refspec->dst : refspec->src;
>                         const char *value = refspec->src;
>
>                         if (match_name_with_pattern(key, needle, value, &expn_name))
> --
> 2.28.0.windows.1
>

  reply	other threads:[~2020-08-24 15:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 21:52 [RFC v2 0/1] implement " Jacob Keller
2020-08-21 21:52 ` [RFC v2 1/1] refspec: add " Jacob Keller
2020-08-22 13:29   ` Johannes Schindelin
2020-08-24 15:47     ` Jacob Keller [this message]
2020-08-24 17:55     ` Junio C Hamano
2020-08-24 19:26       ` Jacob Keller
2020-09-17 20:21   ` Junio C Hamano
2020-09-18  0:01   ` Junio C Hamano
2020-09-24 23:33     ` Jacob Keller
2020-09-24 23:42     ` Jacob Keller

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CA+P7+xp9CEO_wLbqvg26cTWV45mniMwJyJkY8xEmMTqLOWjoSw@mail.gmail.com \
    --to=jacob.keller@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.e.keller@intel.com \
    --cc=peff@peff.net \
    --subject='Re: [RFC v2 1/1] refspec: add support for negative refspecs' \
    /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

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).