From: Junio C Hamano Date: Wed, 21 Feb 2007 06:18:55 GMT Subject: Re: [PATCH] git-remote: support remotes with a dot in the name Message-ID: <7vfy90t4mo.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20070221004631.q4npyww808k88s0o@webmail.spamcop.net> Pavel Roskin writes: > On the other hand, I've been tracking "wireless-2.6" for months without even > realizing that the name could be a problem. Ah, sorry. You are absolutely right. Using wireless-2.6 to name wireless-2.6 repository (or linux-2.6 to name linux-2.6 repository) makes perfect sense. >> I do not strongly oppose to allowing it now, but I suspect this >> is probably less impact: >> >> if (/^remote\.(\S+?)\.([^.\s]+)\s+(.*)$/) { >> ... >> } >> >> With this, we disallow whitespaces in remote names, but we leave >> the door open for supporting variables other than fetch and url >> by accepting the third token that matches any sequence of >> non-dot, non-whitespace letters. > > It would be great as long as we don't use names with more than > one dot after the remote name > (e.g. remote.wireless-2.6.url.push),... Do you mean: [remote "wireless-2.6.url"] url = wire.less:/repo/sito/ry.git fetch = +refs/heads/*:refs/remotes/wireless-2.6.url/* If so I think my replacement would match it. It will be returned from "git config --get-regexp '^remote\.'" like this: remote.wireless-2.6.url.url wire.less:/repo/sito/ry.git remote.wireless-2.6.url.fetch +refs/heads/*:refs/remotes/wireless-2.6.url/* and in: /^remote\.(\S+?)\.([^.\s]+)\s+(.*)$/ $1 would match shortest non-whitespace sequence after "remote.", $2 would match longuest non-dot, non-whitespace sequence before a sequence of whitespaces, and $3 would match everything after that sequence of whitespaces. So, $1 = "wireless-2.6.url", $2 = "url", $3 = "wire.less:/repo/sito/ry.git" or $1 = "wireless-2.6.url", $2 = "fetch", $3 = "+refs/heads/...." But my Perl is rusty, so please double check it.