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

Re: [PATCH 2/2] refs: loosen restriction on wildcard "*" refspecs

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 23, 2015, 17:13 UTC
Message-ID
<xmqq1tfyre46.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqa8umrfge.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> Will squash the changes; no need to resend (unless people discover
> other issues; let's hope that I wouldn't be the one to do so ;-).
>
> Thanks.
>
>> diff --git i/t/t5511-refspec.sh w/t/t5511-refspec.sh
>> index de6db86ccff0..7bfca7962d41 100755
>> --- i/t/t5511-refspec.sh
>> +++ w/t/t5511-refspec.sh
>> @@ -71,11 +71,11 @@ test_refspec fetch ':refs/remotes/frotz/HEAD-to-me'

That was whitespace damaged, so I had to hand-tweak the file in place. While at it, I noticed that we do not check a case where multiple asterisks appear in a single component (which is rejected for a reason different from having multiple components with an asterisk in them), which also deserves its own test.

I'll squash in the following instead.
There is a slightly related tangent I noticed while doing so.

I wonder if there is an obvious and unambiguous interpretation of what this command line wants to do:

    $ git fetch origin refs/heads/*g*/for-linus:refs/remotes/i-*/mine

We _might_ want to allow one (and only one) component with more than one asterisk on the LHS of a refspec, while requiring only one asterisk on the RHS to allow "this '*g*' is just like '*' but excluding things that do not have 'g' in it".

Or it may not be worth the additional complexity.
 t/t5511-refspec.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/t/t5511-refspec.sh b/t/t5511-refspec.sh
index de6db86..f541f30 100755
--- a/t/t5511-refspec.sh
+++ b/t/t5511-refspec.sh
@@ -71,15 +71,18 @@ test_refspec fetch ':refs/remotes/frotz/HEAD-to-me'
 test_refspec push ':refs/remotes/frotz/delete me'		invalid
 test_refspec fetch ':refs/remotes/frotz/HEAD to me'		invalid
 
-test_refspec fetch 'refs/heads/*/for-linus:refs/remotes/mine/*-blah' invalid
-test_refspec push 'refs/heads/*/for-linus:refs/remotes/mine/*-blah' invalid
+test_refspec fetch 'refs/heads/*/for-linus:refs/remotes/mine/*-blah'
+test_refspec push 'refs/heads/*/for-linus:refs/remotes/mine/*-blah'
 
-test_refspec fetch 'refs/heads*/for-linus:refs/remotes/mine/*' invalid
-test_refspec push 'refs/heads*/for-linus:refs/remotes/mine/*' invalid
+test_refspec fetch 'refs/heads*/for-linus:refs/remotes/mine/*'
+test_refspec push 'refs/heads*/for-linus:refs/remotes/mine/*'
 
 test_refspec fetch 'refs/heads/*/*/for-linus:refs/remotes/mine/*' invalid
 test_refspec push 'refs/heads/*/*/for-linus:refs/remotes/mine/*' invalid
 
+test_refspec fetch 'refs/heads/*g*/for-linus:refs/remotes/mine/*' invalid
+test_refspec push 'refs/heads/*g*/for-linus:refs/remotes/mine/*' invalid
+
 test_refspec fetch 'refs/heads/*/for-linus:refs/remotes/mine/*'
 test_refspec push 'refs/heads/*/for-linus:refs/remotes/mine/*'
 
Previous: Jacob KellerNext: Jacob Keller
Message 8 of 13 in “refs: cleanup and new behavior”
  1. 0/2 refs: cleanup and new behaviorJacob Keller, Jul 22, 2015
  2. 1/2 refs: cleanup comments regarding check_refname_componentJacob Keller, Jul 22, 2015
  3. 2/2 refs: loosen restriction on wildcard "*" refspecsJacob Keller, Jul 22, 2015
  4. Junio C HamanoJul 22, 2015
  5. Jacob KellerJul 22, 2015
  6. Junio C HamanoJul 23, 2015
  7. Jacob KellerJul 23, 2015
  8. Junio C HamanoJul 23, 2015
  9. Jacob KellerJul 23, 2015
  10. Eric SunshineJul 23, 2015
  11. Junio C HamanoJul 23, 2015
  12. Keller, Jacob EJul 24, 2015
  13. Junio C HamanoJul 24, 2015

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.