From: Junio C Hamano <firstname.lastname@example.org> To: email@example.com Cc: Jacob Keller <firstname.lastname@example.org>, Jeff King <email@example.com>, Jacob Keller <firstname.lastname@example.org> Subject: Re: [RFC v2 1/1] refspec: add support for negative refspecs Date: Thu, 17 Sep 2020 13:21:40 -0700 [thread overview] Message-ID: <email@example.com> (raw) In-Reply-To: <firstname.lastname@example.org> (Jacob Keller's message of "Fri, 21 Aug 2020 14:52:47 -0700") Jacob Keller <email@example.com> writes: > From: Jacob Keller <firstname.lastname@example.org> > > Both fetch and push support pattern refspecs which allow fetching or > pushing references that match a specific pattern. Because these patterns > are globs, they have somewhat limited ability to express more complex > situations. > > For example, suppose you wish to fetch all branches from a remote except > for a specific one. To allow this, you must setup a set of refspecs > which match only the branches you want. Because refspecs are either > explicit name matches, or simple globs, many patterns cannot be > expressed. > > Add support for a new type of refspec, referred to as "negative" > refspecs. These are prefixed with a '^' and mean "exclude any ref > matching this refspec". They can only have one "side" which always > refers to the source. During a fetch, this refers to the name of the ref > on the remote. During a push, this refers to the name of the ref on the > local side. > > With negative refspecs, users can express more complex patterns. For > example: > > git fetch origin refs/heads/*:refs/remotes/origin/* ^refs/heads/dontwant > > will fetch all branches on origin into remotes/origin, but will exclude > fetching the branch named dontwant. > > Refspecs today are commutative, meaning that order doesn't expressly > matter. Rather than forcing an implied order, negative refspecs will > always be applied last. That is, in order to match, a ref must match at > least one positive refspec, and match none of the negative refspecs. > This is similar to how negative pathspecs work. > > Signed-off-by: Jacob Keller <email@example.com> > --- > > I realize this probably needs to be broken down into multiple patches, but I > haven't quite figured out the best way to do that. I'd like to avoid the > case where a commit has support for parsing negative refspecs but code paths > which use refspecs aren't handling them correctly. Thoughts? > > Splitting would also allow additional space for explanations of some of the > trickier logic. > > I am also definitely looking for more test ideas, to help make sure we > cover a good variety of the flows. Anybody wants to help this move forward? I plan to send a review with the patch in the current form, without waiting for any splitting, later towards the weekend, though.
next prev parent reply other threads:[~2020-09-17 20:21 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 2020-08-24 17:55 ` Junio C Hamano 2020-08-24 19:26 ` Jacob Keller 2020-09-17 20:21 ` Junio C Hamano [this message] 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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --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).