Re: [PATCH 2/2] describe: add support for multiple match patterns
- From
Jacob Keller <jacob.keller@gmail.com>
- Date
- Dec 7, 2016, 23:49 UTC
- Message-ID
- <CA+P7+xrPivwMzGhzKxu30jns+YvSQGXBKUc4JDmfbenTy27tZg@mail.gmail.com>
- In-Reply-To
- <xmqqa8c7wfxu.fsf@gitster.mtv.corp.google.com>
On Wed, Dec 7, 2016 at 2:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> Jacob Keller <jacob.e.keller@intel.com> writes: > >> ... Suppose that you version all >> your official releases such as "v1.2", "v1.3", "v1.4", "v2.1" and so on. >> Now, you also have other tags which represent -rc releases and other >> such tags. If you want to find the first major release that contains >> a given commit you might try >> >> git describe --contains --match="v?.?" <commit> >> >> This will work as long as you have only single digits. But if you start >> adding multiple digits, the pattern becomes not enough to match all the >> tags you wanted while excluding the ones you didn't. > > Isn't what you really want for the use case a negative pattern, > i.e. "I want ones that match v* but not the ones that match *-rc*", > though?
That's another way of implementing it. I just went with straight forward patterns that I was already using in sequence.
Basically, this started as a script to try each pattern in sequence, but this is slow, cumbersome and easy to mess up.
You're suggesting just add a single second pattern that we will do matches and discard any tag that matches that first?
I think I can implement that pretty easily, and it should have simpler semantics. We can discard first, and then match what remains easily.
Thanks, Jake