Re: [PATCH] translate bad characters in refnames during git-svn fetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



also sprach Eric Wong <normalperson@xxxxxxxx> [2007.07.17.1428 +0200]:
> I like it, too.  How about something like the two functions below?
> This will break things a bit for people currently using % in
> refnames, however.

Well, wait. git-svn usually works in its own repo, and if that's
tracked by another repo, then it is tracked under the
remote/whatever namespace, so there should not be any conflicts. You
also hardly ever run git-svn to clone stuff *into* an existing repo,
so there can't be conflicts with existing refnames-with-%. Thus the
only breakage is if a person creates a new refname inside a git-svn
repo, which uses % in such a way as to collide with an imported
branch/tag/whatever from git-svn. That's not breakage, since git
will just refuse to do it.

Remember that we're only translating from <char> -> %XX, never the
other way around, really. Okay, we might be during git-svn
rebase/dcommit, but only for those refnames which we store in
.git/svn/ anyway. So a user-specified refname containing % will not
be a problem, will it?

> I think this will work rather nicely once I've figured out how the path
> globbing code works[1] and where to sanitize/desanitize the refnames
> properly.

I am glad you're having the same problem; makes me feel less stupid.
:)

>   Somebody naming directories on the SVN side with the path component
>   ":refs/remotes" in them could screw things up for us.

Those people should be tarred and feathered. git owns the trademark
on these names.

> sub desanitize_ref_name {
> 	my ($refname) = @_;
> 	$refname =~ s{%(?:([0-9A-F]{2})}{chr hex($1)}g;
> 
> 	$refname;
> }

We could make it escape to %25; instead of %25. That's ugly but it
would make desanitation a little safer.

> > On the other hand, we could make the translation regexps
> > configurable...
> 
> Hopefully not needed.  I fear it would just add to confusion.

I was thinking about something like.

  git-svn clone ...
  ...
  error: remote branch/tagn name includes ~, which git does not
  allow. please specify a replacement character in .git/config

and then have config.svn-remote.svn.translations simply be a list of
pairs in vim pairlist syntax:

  ~:!,^:#,.:\,

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; net@madduck
 
spamtraps: madduck.bogus@xxxxxxxxxxx
 
"it is easier to be a lover than a husband for the simple reason
 that it is more difficult to be witty every day
 than to say pretty things from time to time."
                                                   -- honoré de balzac

Attachment: signature.asc
Description: Digital signature (GPG/PGP)


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux