Bug-Report: git-svn and backslash in SVN branch name
Hi,
I'm trying to clone a SVN repo in order to migrate it to git but i hit a wall with SVN branch names that contain a backslash, which seems to be allowed in SVN but prohibited in git refs:
r289 = c4cb1f0c34e741a07de9673515c853d49c5522b9 (refs/remotes/origin/dicomBaseClass)
Found possible branch point: file:///path.repo/trunk/dicomBaseClass => file:///path.repo/tags/dicomBaseClass%5Cv0.1, 181 Initializing parent: refs/remotes/origin/tags/dicomBaseClass\v0.1@181
W: Ignoring error from SVN, path probably does not exist: (160013):
Filesystem has no item: File not found: revision 101, path '/trunk/dicomBaseClass'
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
Found possible branch point: file:///path.repo/dicomBaseClass => file:///path.repo/trunk/dicomBaseClass, 172
Initializing parent: refs/remotes/origin/tags/dicomBaseClass\v0.1@172
fatal: update_ref failed for ref 'refs/remotes/origin/tags/dicomBaseClass\v0.1@172': refusing to update ref with bad name 'refs/remotes/origin/tags/dicomBaseClass\v0.1@172' update-ref -m r75 refs/remotes/origin/tags/dicomBaseClass\v0.1@172 1fe0cc23e3cd56a1087562f8ca3d2e40cd2b30d4: command returned error: 128
The tag in case is "dicomBaseClass\v0.1@172".
Is there a way to mangle those names on the fly to get rid of the backslashes or can they be handled in any other way to be compatible with git?
Cheers,
Signature · 2 lines
Michael Fladischer Fladi.at
PATCH 1/1 git-svn: escape backslashes in refnames
Hi Michael, the patch below should fix things up.
Junio: this should go to 'maint', pull request below.
----------------8<---------------
Subject: [PATCH] git-svn: escape backslashes in refnames
This brings git-svn refname escaping up-to-date with commit a4c2e69936df8dd0b071b85664c6cc6a4870dd84 ("Disallow '\' in ref names") from May 2009.
Message-ID: <[email protected]>
---
The following changes since commit a274e0a036ea886a31f8b216564ab1b4a3142f6c:
Sync with maint-2.10 (2016-12-05 11:25:47 -0800)
are available in the git repository at:
git://bogomips.org/git-svn.git svn-escape-backslash
for you to fetch changes up to 22af6fef9b6538c9e87e147a920be9509acf1ddd:
git-svn: escape backslashes in refnames (2016-12-23 01:37:36 +0000)
----------------------------------------------------------------
Eric Wong (1):
git-svn: escape backslashes in refnames
perl/Git/SVN.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
perl/Git/SVN.pm +1 -1
@@ -490,7 +490,7 @@ sub refname { # # Additionally, % must be escaped because it is used for escaping # and we want our escaped refname to be reversible - $refname =~ s{([ \%~\^:\?\*\[\t])}{sprintf('%%%02X',ord($1))}eg; + $refname =~ s{([ \%~\^:\?\*\[\t\\])}{sprintf('%%%02X',ord($1))}eg; # no slash-separated component can begin with a dot . # /.* becomes /%2E*
Signature · 1 line
EW
Re: [PATCH] git-svn: escape backslashes in refnames
Quoted 1 line · Eric Wong
Hi Michael, the patch below should fix things up.
Thank you Eric, I was able to successfully fetch the SVN tag with your patch applied.
Cheers,
Signature · 2 lines
Michael Fladischer Fladi.at
Re: [PATCH] git-svn: escape backslashes in refnames
In reply to Eric WongRe: [PATCH] git-svn: escape backslashes in refnames
Quoted 5 lines · Eric Wong
Junio: ping?
https://public-inbox.org/git/20161223014202.GA8327@starla/raw
Thanks.
Thanks for reminding. This indeed fell thru cracks.