{"thread":{"id":"43222","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","startedAt":"2006-12-04T19:38:22Z","lastAt":"2006-12-06T23:38:24Z","messageCount":11,"participants":["Michael Loeffler","Junio C Hamano","Johannes Schindelin","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"297208","messageId":"1165261102.20055.9.camel@ibook.zvpunry.de","threadId":"43222","inReplyTo":null,"subject":"[PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Michael Loeffler","fromEmail":"loeffler@ls-itc.de","sentAt":"2006-12-04T19:38:22Z","receivedAt":"2006-12-04T19:38:22Z","isPatch":true,"sender":{"key":"loeffler@ls-itc.de","avatar":null},"body":"The trailing / is enough to decide if this should map everything under\nrefs/heads/ to refs/somewhere/.\n\nThe \"*\" should be reserved for the use as regex operator.\n\nSigned-off-by: Michael Loeffler <zvpunry@zvpunry.de>\n---\nI want to use regular expressions to match remote refs, so I try to\nimplement this. But the current globfetch syntax needs the '*'.\n\nMaybe it is not to late to change the syntax to this:\nPull: refs/heads/:refs/remotes/origin/\n\nWhat do you think?\n\n\ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\nindex da064a5..38af4cb 100755\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -101,13 +101,13 @@ expand_refs_wildcard () {\n \tdo\n \t\tlref=${ref#'+'}\n \t\t# a non glob pattern is given back as-is.\n-\t\texpr \"z$lref\" : 'zrefs/.*/\\*:refs/.*/\\*$' >/dev/null || {\n+\t\texpr \"z$lref\" : 'zrefs/.*/:refs/.*/$' >/dev/null || {\n \t\t\techo \"$ref\"\n \t\t\tcontinue\n \t\t}\n \n-\t\tfrom=`expr \"z$lref\" : 'z\\(refs/.*/\\)\\*:refs/.*/\\*$'`\n-\t\tto=`expr \"z$lref\" : 'zrefs/.*/\\*:\\(refs/.*/\\)\\*$'`\n+\t\tfrom=`expr \"z$lref\" : 'z\\(refs/.*/\\):refs/.*/$'`\n+\t\tto=`expr \"z$lref\" : 'zrefs/.*/:\\(refs/.*/\\)$'`\n \t\tlocal_force=\n \t\ttest \"z$lref\" = \"z$ref\" || local_force='+'\n \t\techo \"$ls_remote_result\" |\n-- \n1.4.4\n\n\n"},{"id":"298510","messageId":"el1tud$n07$2@sea.gmane.org","threadId":"43222","inReplyTo":"1165261102.20055.9.camel@ibook.zvpunry.de","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-04T19:48:27Z","receivedAt":"2006-12-04T19:48:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael Loeffler wrote:\n\n> The trailing / is enough to decide if this should map everything under\n> refs/heads/ to refs/somewhere/.\n> \n> The \"*\" should be reserved for the use as regex operator.\n> \n> Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>\n> ---\n> I want to use regular expressions to match remote refs, so I try to\n> implement this. But the current globfetch syntax needs the '*'.\n> \n> Maybe it is not to late to change the syntax to this:\n> Pull: refs/heads/:refs/remotes/origin/\n> \n> What do you think?\n\nI'm not sure if regexp support is truly better than the usual path globbing,\nas in fnmatch / glob.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"294066","messageId":"1165261784.20871.6.camel@ibook.zvpunry.de","threadId":"43222","inReplyTo":"1165261102.20055.9.camel@ibook.zvpunry.de","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Michael Loeffler","fromEmail":"zvpunry@zvpunry.de","sentAt":"2006-12-04T19:49:44Z","receivedAt":"2006-12-04T19:49:44Z","isPatch":true,"sender":{"key":"zvpunry@zvpunry.de","avatar":null},"body":"I used the wrong email-account for this patch, please reply to\nzvpunry@zvpunry.de. Sorry.\n\nbye\n"},{"id":"296832","messageId":"1165422865.29714.13.camel@ibook.zvpunry.de","threadId":"43222","inReplyTo":"el1tud$n07$2@sea.gmane.org","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Michael Loeffler","fromEmail":"zvpunry@zvpunry.de","sentAt":"2006-12-06T16:34:25Z","receivedAt":"2006-12-06T16:34:25Z","isPatch":true,"sender":{"key":"zvpunry@zvpunry.de","avatar":null},"body":"Am Montag, den 04.12.2006, 20:48 +0100 schrieb Jakub Narebski:\n...\n> I'm not sure if regexp support is truly better than the usual path globbing,\n> as in fnmatch / glob.\nThe current code does not do a real glob, this was the reason for me to\nthink about regex support, I thought it is easy to use sed for this. Now\nI know it better.\n\nI want it a bit portable, but sed on other systems (like macos or\nsolaris) does not support extended REs, and the basic REs do not support\nthe | operator (but this works on systems with glibc with \\|).\n\nMaybe we should support something like this:\nPull: refs/heads/v*:refs/remotes/origin/\n\nI still don't like the * on the destination ref, it looks a bit strange\n(like cp Downloads/*.mp3 Music/*).\n\n"},{"id":"295580","messageId":"el6sni$re3$1@sea.gmane.org","threadId":"43222","inReplyTo":"1165422865.29714.13.camel@ibook.zvpunry.de","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-06T16:58:27Z","receivedAt":"2006-12-06T16:58:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael Loeffler wrote:\n\n> Am Montag, den 04.12.2006, 20:48 +0100 schrieb Jakub Narebski:\n> ...\n>> I'm not sure if regexp support is truly better than the usual path globbing,\n>> as in fnmatch / glob.\n>\n> The current code does not do a real glob, this was the reason for me to\n> think about regex support, I thought it is easy to use sed for this. Now\n> I know it better.\n\nWe could use perl for that, but embedded perl is a bit horrible.\n\n> I want it a bit portable, but sed on other systems (like macos or\n> solaris) does not support extended REs, and the basic REs do not support\n> the | operator (but this works on systems with glibc with \\|).\n> \n> Maybe we should support something like this:\n> Pull: refs/heads/v*:refs/remotes/origin/\n> \n> I still don't like the * on the destination ref, it looks a bit strange\n> (like cp Downloads/*.mp3 Music/*).\n\n'*' in destination part would mean $n / \\n (n-th match for *).\nAnd you need some way to mark if it is prefix match, or whole path match.\nEnding prefix match with '/' is one way of doing this... Unless it would\nbe prefix match always, but I think this leads way to confusion.\n\nJust a thought.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"296570","messageId":"1165429001.993.35.camel@ibook.zvpunry.de","threadId":"43222","inReplyTo":"el6sni$re3$1@sea.gmane.org","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Michael Loeffler","fromEmail":"zvpunry@zvpunry.de","sentAt":"2006-12-06T18:16:40Z","receivedAt":"2006-12-06T18:16:40Z","isPatch":true,"sender":{"key":"zvpunry@zvpunry.de","avatar":null},"body":"Am Mittwoch, den 06.12.2006, 17:58 +0100 schrieb Jakub Narebski:\n...\n> We could use perl for that, but embedded perl is a bit horrible.\nI had the same idea after the sed problems with macos/solaris, but\nembedded perl is really a bit horrible.\n\n...\n> '*' in destination part would mean $n / \\n (n-th match for *).\n> And you need some way to mark if it is prefix match, or whole path match.\n> Ending prefix match with '/' is one way of doing this... Unless it would\n> be prefix match always, but I think this leads way to confusion.\nThen we could just use (.*) and \\1..9 and use extended REs. The only\nproblem is this stupid sed thing, only GNU-sed has the -r\noption to use extended REs.\n\n> Just a thought.\nI would prefer the following ways to do this globfetch stuff:\n\n1.) The original refspec:\n    Pull: refs/heads/master:refs/remotes/origin/master\n\n2.) The one with \"prefix match\":\n    Pull: refs/heads/:refs/remotes/origin/\n\n3.) The one with extended regex:\n    Pull: refs/heads/(.*):refs/remotes/origin/\\1\n\n\n"},{"id":"297291","messageId":"el71tj$edm$1@sea.gmane.org","threadId":"43222","inReplyTo":"1165429001.993.35.camel@ibook.zvpunry.de","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-06T18:27:00Z","receivedAt":"2006-12-06T18:27:00Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael Loeffler wrote:\n\n>> We could use perl for that, but embedded perl is a bit horrible.\n>\n> I had the same idea after the sed problems with macos/solaris, but\n> embedded perl is really a bit horrible.\n\nOr you can rewrite git-fetch in Perl (or as built-in in C).\n\n> I would prefer the following ways to do this globfetch stuff:\n> \n> 1.) The original refspec:\n>     Pull: refs/heads/master:refs/remotes/origin/master\n> \n> 2.) The one with \"prefix match\":\n>     Pull: refs/heads/:refs/remotes/origin/\n\nI just worry what would happen when someone would write e.g.\n      Pull: refs/heads/:refs/heads/origin-\n \n> 3.) The one with extended regex:\n>     Pull: refs/heads/(.*):refs/remotes/origin/\\1\n\n3.) The one with shell-like (fnmatch / glob) globbing\n      Pull: refs/heads/*:refs/remotes/origin/*\n\nBy the way, with globbing we really need some other way than\nfirst Pull: line to select remote head to merge on \"git pull\".\nFor example \"Merge:\" line / remote.<name>.merge config var.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"298031","messageId":"7vejrc50qu.fsf@assigned-by-dhcp.cox.net","threadId":"43222","inReplyTo":"1165429001.993.35.camel@ibook.zvpunry.de","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-06T18:37:45Z","receivedAt":"2006-12-06T18:37:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Loeffler <zvpunry@zvpunry.de> writes:\n\n>> Just a thought.\n> I would prefer the following ways to do this globfetch stuff:\n>\n> 1.) The original refspec:\n>     Pull: refs/heads/master:refs/remotes/origin/master\n>\n> 2.) The one with \"prefix match\":\n>     Pull: refs/heads/:refs/remotes/origin/\n>\n> 3.) The one with extended regex:\n>     Pull: refs/heads/(.*):refs/remotes/origin/\\1\n\nPlease, don't do regex when talking about paths.  Uniformly\nusing fnmatch/glob is less confusing.  I do not see anything\nwrong with Andy's refspec glob we already have.  Although I\nagree that the second asterisk in \"src/*:dst/*\" has a certain\n\"Huh?\" factor to UNIX-trained eyes, I think it is quite obvious\neven to new people what it does.\n\nAlso, while I agree that (2) is logical and less typing, I would\navoid cases where foo and foo/ behave differently when \"foo\"\nitself is a directory/tree like thing.  Doing otherwise easily\ninvites mistakes.\n\n"},{"id":"294906","messageId":"7vac2050nm.fsf@assigned-by-dhcp.cox.net","threadId":"43222","inReplyTo":"el71tj$edm$1@sea.gmane.org","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-06T18:39:41Z","receivedAt":"2006-12-06T18:39:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> 3.) The one with shell-like (fnmatch / glob) globbing\n>       Pull: refs/heads/*:refs/remotes/origin/*\n>\n> By the way, with globbing we really need some other way than\n> first Pull: line to select remote head to merge on \"git pull\".\n> For example \"Merge:\" line / remote.<name>.merge config var.\n\nWhy?\n\n        URL: some-where\n        Pull: refs/heads/master:refs/remotes/origin/master\n        Pull: refs/heads/*:refs/remotes/origin/*\n\nworks just fine.\n\nBut we should encourage people to use config to define default\nmerge source per-branch.\n"},{"id":"295154","messageId":"Pine.LNX.4.63.0612070020580.28348@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43222","inReplyTo":"el6sni$re3$1@sea.gmane.org","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-06T23:21:57Z","receivedAt":"2006-12-06T23:21:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 6 Dec 2006, Jakub Narebski wrote:\n\n> Michael Loeffler wrote:\n> \n> > Am Montag, den 04.12.2006, 20:48 +0100 schrieb Jakub Narebski:\n> > ...\n> >> I'm not sure if regexp support is truly better than the usual path globbing,\n> >> as in fnmatch / glob.\n> >\n> > The current code does not do a real glob, this was the reason for me to\n> > think about regex support, I thought it is easy to use sed for this. Now\n> > I know it better.\n> \n> We could use perl for that, but embedded perl is a bit horrible.\n\nNot to talk about portable, and as we saw, dependent on the C compiler \n(you would have to make git compile with the same C compiler that perl was \ncompiled with).\n\nSo, please look into other options first.\n\nCiao,\n"},{"id":"295361","messageId":"200612070038.24920.jnareb@gmail.com","threadId":"43222","inReplyTo":"Pine.LNX.4.63.0612070020580.28348@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 2/3] git-fetch: do not use \"*\" for fetching multiple refs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-06T23:38:24Z","receivedAt":"2006-12-06T23:38:24Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin wrote:\n\n> On Wed, 6 Dec 2006, Jakub Narebski wrote:\n> \n>> Michael Loeffler wrote:\n>> \n>>> Am Montag, den 04.12.2006, 20:48 +0100 schrieb Jakub Narebski:\n>>> ...\n>>>> I'm not sure if regexp support is truly better than the usual path globbing,\n>>>> as in fnmatch / glob.\n>>>\n>>> The current code does not do a real glob, this was the reason for me to\n>>> think about regex support, I thought it is easy to use sed for this. Now\n>>> I know it better.\n>> \n>> We could use perl for that, but embedded perl is a bit horrible.\n> \n> Not to talk about portable, and as we saw, dependent on the C compiler \n> (you would have to make git compile with the same C compiler that perl was \n> compiled with).\n> \n> So, please look into other options first.\n\nNo, not embedded in C, but embedded in shell script.\nUse perl -ip instead of sed.\n\n-- \nJakub Narebski\n"}]}