From: Daniel Barkalow <barkalow@iabervon.iabervon.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jacob Keller <jacob.keller@gmail.com>, git@vger.kernel.org
Subject: Re: refspecs with '*' as part of pattern
Date: Mon, 6 Jul 2015 22:20:24 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.00.1507062208580.2241@iabervon.iabervon.org> (raw)
In-Reply-To: <xmqqzj38yjpg.fsf@gitster.dls.corp.google.com>
On Mon, 6 Jul 2015, Junio C Hamano wrote:
> Jacob Keller <jacob.keller@gmail.com> writes:
>
> > I've been looking at the refspecs for git fetch, and noticed that
> > globs are partially supported. I wanted to use something like:
> >
> > refs/tags/some-prefix-*:refs/tags/some-prefix-*
> >
> > as a refspec, so that I can fetch only tags which have a specific
> > prefix. I know that I could use namespaces to separate tags, but
> > unfortunately, I am unable to fix the tag format. The specific
> > repository in question is also generating several tags which are not
> > relevant to me, in formats that are not really useful for human
> > consumption. I am also not able to fix this less than useful practice.
> >
> > However, I noticed that refspecs only support * as a single component.
> > The match algorithm works perfectly fine, as documented in
> > abd2bde78bd9 ("Support '*' in the middle of a refspec")
> >
> > What is the reason for not allowing slightly more arbitrary
> > expressions? Obviously no more than one *...
>
> I cannot seem to be able to find related discussions around that
> patch, so this is only my guess, but I suspect that this is to
> discourage people from doing something like:
>
> refs/tags/*:refs/tags/foo-*
>
> which would open can of worms (e.g. imagine you fetch with that
> pathspec and then push with refs/tags/*:refs/tags/* back there;
> would you now get foo-v1.0.0 and foo-foo-v1.0.0 for their v1.0.0
> tag?) we'd prefer not having to worry about.
That wouldn't be it, since refs/tags/*:refs/tags/foo/* would have the same
problem, assuming you didn't set up the push refspec carefully.
I think it was mostly that it would be too easy to accidentally do
something you don't want by having some other character instead of a
slash, like refs/heads/*:refs/heads-*.
Aside from the increased risk of hard-to-spot typos leading to very weird
behavior, nothing actually goes wrong; in fact, I've been using git with
that check removed for ages because I wanted a refspec like
refs/heads/something-*:refs/heads/*. And it works fine as a local patch,
since you don't need your refspec handling to interoperate with other
repositories.
-Daniel
*This .sig left intentionally blank*
next prev parent reply other threads:[~2015-07-07 2:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 18:31 refspecs with '*' as part of pattern Jacob Keller
2015-07-06 23:01 ` Junio C Hamano
2015-07-06 23:39 ` Jacob Keller
2015-07-07 2:20 ` Daniel Barkalow [this message]
2015-07-07 2:33 ` Jacob Keller
2015-07-07 7:22 ` Jacob Keller
2015-07-07 16:28 ` Junio C Hamano
2015-07-07 23:20 ` 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=alpine.LNX.2.00.1507062208580.2241@iabervon.iabervon.org \
--to=barkalow@iabervon.iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.com \
/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.
Code repositories for project(s) associated with this public 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).