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

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:18

Daniel Barkalow [off-list ref] writes:
My use case is actually, more precisely:

some/constant/stuff/$PROJ-$NUMBER/junk/my-proj

Where $NUMBER is the version number, and $PROJ is usually, but not quite 
always "my-proj"; the exception being that it might be effectively a 
superproject. So I'd like to have:

 fetch = some/constant/stuff/my-proj-*/junk/my-proj:refs/remotes/origin/*
... and expect "some/constant/stuff/my-proj-2.5/junk/my-proj" to be mapped
to "refs/remotes/origin/2.5"?  I think it does not look too bad.
But I can live with remote branches like "my-proj-2.4" instead of "2.4".

I think it would make sense, and limit typo damage, to say that the * can 
only expand to something with a '/' in it if the star has a slash or the 
end of the string on each side.
I do not understand what you mean by "* can only expand to something with
a '/' in it if ..." part.  None of the examples in your message have a
case where the asterisk matches across directory boundaries, and I thought
you would simply say "* does not match /" and be done with that.

What scenario do you have in mind that wants to match a slash with an
asterisk?

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

From: Jay Soffian <hidden>
Date: 2016-06-15 22:46:18

On Mon, Mar 2, 2009 at 12:08 PM, Junio C Hamano [off-list ref] wrote:
Daniel Barkalow [off-list ref] writes:
quoted
My use case is actually, more precisely:

some/constant/stuff/$PROJ-$NUMBER/junk/my-proj

Where $NUMBER is the version number, and $PROJ is usually, but not quite
always "my-proj"; the exception being that it might be effectively a
superproject. So I'd like to have:

 fetch = some/constant/stuff/my-proj-*/junk/my-proj:refs/remotes/origin/*
... and expect "some/constant/stuff/my-proj-2.5/junk/my-proj" to be mapped
to "refs/remotes/origin/2.5"?  I think it does not look too bad.
quoted
But I can live with remote branches like "my-proj-2.4" instead of "2.4".

I think it would make sense, and limit typo damage, to say that the * can
only expand to something with a '/' in it if the star has a slash or the
end of the string on each side.
I do not understand what you mean by "* can only expand to something with
a '/' in it if ..." part.  None of the examples in your message have a
case where the asterisk matches across directory boundaries, and I thought
you would simply say "* does not match /" and be done with that.

What scenario do you have in mind that wants to match a slash with an
asterisk?
I think he means the following are valid:

 - foo/bar/*/baz
 - foo/bar/baz/*

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.

j.

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

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:46:18

On Mon, 2 Mar 2009, Junio C Hamano wrote:
Daniel Barkalow [off-list ref] writes:
quoted
My use case is actually, more precisely:

some/constant/stuff/$PROJ-$NUMBER/junk/my-proj

Where $NUMBER is the version number, and $PROJ is usually, but not quite 
always "my-proj"; the exception being that it might be effectively a 
superproject. So I'd like to have:

 fetch = some/constant/stuff/my-proj-*/junk/my-proj:refs/remotes/origin/*
... and expect "some/constant/stuff/my-proj-2.5/junk/my-proj" to be mapped
to "refs/remotes/origin/2.5"?  I think it does not look too bad.
Yeah.
quoted
But I can live with remote branches like "my-proj-2.4" instead of "2.4".

I think it would make sense, and limit typo damage, to say that the * can 
only expand to something with a '/' in it if the star has a slash or the 
end of the string on each side.
I do not understand what you mean by "* can only expand to something with
a '/' in it if ..." part.  None of the examples in your message have a
case where the asterisk matches across directory boundaries, and I thought
you would simply say "* does not match /" and be done with that.

What scenario do you have in mind that wants to match a slash with an
asterisk?
Backwards compatibility? Currently, refs/heads/*:refs/remotes/origin/* 
will match refs/heads/js/notes with refs/remotes/origin/js/notes, because 
it simply copies everything after the fixed prefix.

I was assuming that that particular matching is an existing requirement 
(and that you used it regularly to share topic-maintenance work between 
machines).

So my idea was that a path component of "*" would be able to match 
multiple levels, while a path component of "something-*" or "*-something" 
can only match a single path component that starts or ends with the right 
thing. Looking at it now, I think it might be more sane to use "%" for the 
second case, and say: "*" must be used as a full path component, and 
matches one or more path components; "%" may be used as part of a path 
component, and doesn't match the path separator; you can only use one such 
character, and both sides of the refspec have to agree on which.

I think the problem cases were typos like:

refs/heads*:refs/remotes/origin/* (used to cause problems)

and

refs/heads/*:refs/remotes/origin* (gives you the originmaster remote?)

	-Daniel
*This .sig left intentionally blank*

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

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:46:18

On Mon, 2 Mar 2009, Jay Soffian wrote:
On Mon, Mar 2, 2009 at 12:08 PM, Junio C Hamano [off-list ref] wrote:
quoted
Daniel Barkalow [off-list ref] writes:
quoted
My use case is actually, more precisely:

some/constant/stuff/$PROJ-$NUMBER/junk/my-proj

Where $NUMBER is the version number, and $PROJ is usually, but not quite
always "my-proj"; the exception being that it might be effectively a
superproject. So I'd like to have:

 fetch = some/constant/stuff/my-proj-*/junk/my-proj:refs/remotes/origin/*
... and expect "some/constant/stuff/my-proj-2.5/junk/my-proj" to be mapped
to "refs/remotes/origin/2.5"?  I think it does not look too bad.
quoted
But I can live with remote branches like "my-proj-2.4" instead of "2.4".

I think it would make sense, and limit typo damage, to say that the * can
only expand to something with a '/' in it if the star has a slash or the
end of the string on each side.
I do not understand what you mean by "* can only expand to something with
a '/' in it if ..." part.  None of the examples in your message have a
case where the asterisk matches across directory boundaries, and I thought
you would simply say "* does not match /" and be done with that.

What scenario do you have in mind that wants to match a slash with an
asterisk?
I think he means the following are valid:

 - foo/bar/*/baz
 - foo/bar/baz/*

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".

	-Daniel
*This .sig left intentionally blank*

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

From: Jay Soffian <hidden>
Date: 2016-06-15 22:46:19

On Mon, Mar 2, 2009 at 1:25 PM, Daniel Barkalow [off-list ref] wrote:
quoted
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.

?

j.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help