From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Jeff King <peff@peff.net>, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [RFC v2 1/1] refspec: add support for negative refspecs
Date: Sat, 22 Aug 2020 15:29:49 +0200 (CEST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.2008221528170.56@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20200821215247.758978-2-jacob.e.keller@intel.com>
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:
-- 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
next prev parent reply other threads:[~2020-08-23 20:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 21:52 [RFC v2 0/1] implement support for negative refspecs Jacob Keller
2020-08-21 21:52 ` [RFC v2 1/1] refspec: add " Jacob Keller
2020-08-22 13:29 ` Johannes Schindelin [this message]
2020-08-24 15:47 ` Jacob Keller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.76.6.2008221528170.56@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=peff@peff.net \
/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).