git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Ewald <robert.ewald@nov.com>
To: git@vger.kernel.org
Subject: Re: (Resend)[PATCH] git-svn: Translate invalid characters in refname
Date: Mon, 30 Jul 2007 15:33:11 +0200	[thread overview]
Message-ID: <f8kpan$t6c$1@sea.gmane.org> (raw)
In-Reply-To: 7v6442kxvu.fsf@assigned-by-dhcp.cox.net

Junio C Hamano wrote:

> Robert Ewald <robert.ewald@nov.com> writes:
> 
>> +sub refname {
>> +        my ($refname) = "refs/remotes/$_[0]->{ref_id}" ;
>> +
>> +        # It cannot end with a slash /, we'll throw up on this because
>> +        # SVN can't have directories with a slash in their name, either:
>> +        if ($refname =~ m{/$}) {
>> +                die "ref: '$refname' ends with a trailing slash, this is ",
>> +                    "not permitted by git nor Subversion\n";
>> +        }
>> +
>> +        # It cannot have ASCII control character space, tilde ~, caret ^,
>> +        # colon :, question-mark ?, asterisk *, space, or open bracket [
>> +        # anywhere.
>> +        #
>> +        # Additionally, % must be escaped because it is used for escaping
>> +        # and we want our escaped refname to be reversible
>> +        $refname =~ s{([ \%~\^:\?\*\[\t])}{uc sprintf('%%%02x',ord($1))}eg;
> 
> uc of sprintf()?  You meant "%%%02X"?

You are right. Being a total Perl noob I just took Eric's suggestion from an
earlier post without really understanding everything.

> Other than that, looks sane to me.  I presume that SVN branches
> whose name would be mangled with this patch would not have been
> successfully imported with older git-svn anyway, so this won't
> introduce any regressions?

Now that you mention it, I am not entirely sure. We introduce the % which is
mangled as well. It wasn't mangled before.

I now could think of a case that someone has a git-svn branch with a % in the
name checked out.

When updates are fetched a new branch head would be created. It wouldn't 
destroy anything, but a script might break. On the other hand, the script needs
to be updated anyway. So I am not sure if % should be handled separately.

> Eric?
Yes, Eric, please comment.

-- 
Robert Ewald

  reply	other threads:[~2007-07-30 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-30  9:08 (Resend)[PATCH] git-svn: Translate invalid characters in refname Robert Ewald
2007-07-30 10:07 ` Junio C Hamano
2007-07-30 13:33   ` Robert Ewald [this message]
2007-07-30 19:29   ` Eric Wong
2007-07-31  0:20 ` Junio C Hamano
2007-08-15 22:53 ` martin f krafft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='f8kpan$t6c$1@sea.gmane.org' \
    --to=robert.ewald@nov.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).