git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] Refspec patterns with * in the middle

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Mar 2, 2009, 23:00 UTC
Message-ID
<alpine.LNX.1.00.0903021746140.19665@iabervon.org>
In-Reply-To
<7v1vtfmtwj.fsf@gitster.siamese.dyndns.org>
On Mon, 2 Mar 2009, Junio C Hamano wrote:
Show 32 quoted lines
> Jay Soffian <jaysoffian@gmail.com> writes:
> 
> > On Mon, Mar 2, 2009 at 1:25 PM, Daniel Barkalow <barkalow@iabervon.org> wrote:
> >>> But the following is not:
> >>>
> >>>  - foo/bar*/baz
> >>>
> >>> IOW, '*' can only appear as a non-terminating symbol if it is bounded
> >>> by '/' on each side.
> >>
> >> You have my criterion right, but I want that to be valid, but only match
> >> things like "foo/bar-something/baz", not "foo/bar-a/b/baz".
> >
> > Ah, that makes sense. Perhaps use "**" to mean matching across path
> > components which is what rsync does:
> >
> >  o  a '*' matches any non-empty path component (it stops at slashes).
> >  o  use '**' to match anything, including slashes.
> >
> > ?
> 
> I personally do not think that makes much sense (and I find ** ugly, too).
> 
> We traditionally supported '*' only at the end, and it always has meant
> "match through the end, including slashes".
> 
> Requiring 'match including slashes' to be spelled as '**' only when it is
> not at the end is unnecessarily confusing.
> 
> Is there a valid use case when * wants to match across directory
> boundaries when it is not at the end?  I offhand do not think of a sane
> one.
Maybe:
/refs/imported/$GROUP/$USER/project -> $GROUP/$USER
or
/refs/imported/sandbox/$USER/$TOPIC/project -> $USER/$TOPIC

The issue, in my case, is importing from a system where branches contain projects instead of projects containing branches (and everything is a single namespace). So I want to match an insane (for us) LHS with a sane RHS to get stuff into reasonable shape. I don't really care about any patterns where the branch identifier is multiple components, but I wouldn't be surprised if somebody did.

Oh, and it looks like "?" is reserved and currently unused, so we could have * match one or more full path components, and ? match partial path components.

	-Daniel
*This .sig left intentionally blank*
Previous: Jay SoffianNext: Junio C Hamano
Message 9 of 12 in “[RFC] Refspec patterns with * in the middle”
  1. Daniel BarkalowMar 1, 2009
  2. Jay SoffianMar 2, 2009
  3. Junio C HamanoMar 2, 2009
  4. Jay SoffianMar 2, 2009
  5. Daniel BarkalowMar 2, 2009
  6. Jay SoffianMar 2, 2009
  7. Junio C HamanoMar 2, 2009
  8. Jay SoffianMar 2, 2009
  9. Daniel BarkalowMar 2, 2009
  10. Junio C HamanoMar 2, 2009
  11. David KastrupMar 3, 2009
  12. Daniel BarkalowMar 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.