* Re: [msysGit] Trailing spaces in branchname (git-svn) [not found] <0014af8a-3b24-4398-88aa-7a3e460f2283@s11g2000yqh.googlegroups.com> @ 2011-03-24 21:26 ` Erik Faye-Lund [not found] ` <12ada6de-4345-4259-b832-371a74df9775@l6g2000vbn.googlegroups.com> 0 siblings, 1 reply; 5+ messages in thread From: Erik Faye-Lund @ 2011-03-24 21:26 UTC (permalink / raw) To: Barthus; +Cc: msysGit, Git Mailing List On Thu, Mar 24, 2011 at 9:16 PM, Barthus <magnus.kallstrom@gmail.com> wrote: > I am trying to clone a subversion repository that has a branchname > with a trailing space. Since I can't find a solution I downloaded the > code to try to understand the problem. Since I am not familiar with > perl it is a bit hard for me. This is what I have found out so far: > > In git-svn.perl: > tmp_index_do is called and tries to create the folder with the > trailing space (under svn/refs/remotes) with the following line of > code: > mkpath([$dir]) unless -d $dir; > reading the solution above, I figured that I should be able to > "sanitize" the path -reusing som code already existing in the script: > sub refname > I then tried to: > git svn fetch > > Now the folder gets created, but then some lockfile is supposed to be > created (with the trailing space in the path), and it fails again. > > I have not been able to locate the call that tries to create the > lockfile (yet), and I guess there will be more fileoperations made to > the folder. If I manage to figure out the code my theory now is to > "sanitize" the branchname in the structure where it is contained when > it comes from subversion (possibly adding a "sanitized" storage to not > destroy the original name if it is needed), and see if the clone/fetch > can continue. > > My hope is though, that someone who understands this maybe can fix it, > or maybe point me in the right direction. This kind of question is usually better to ask on the main Git mailing list, as it's not really Windows specific. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <12ada6de-4345-4259-b832-371a74df9775@l6g2000vbn.googlegroups.com>]
* Re: Trailing spaces in branchname (git-svn) [not found] ` <12ada6de-4345-4259-b832-371a74df9775@l6g2000vbn.googlegroups.com> @ 2011-06-15 14:00 ` Erik Faye-Lund [not found] ` <b8767de1-ab2c-4d2a-9024-9ad9b29c614d@j9g2000vbs.googlegroups.com> 0 siblings, 1 reply; 5+ messages in thread From: Erik Faye-Lund @ 2011-06-15 14:00 UTC (permalink / raw) To: Barthus; +Cc: msysGit, Git Mailing List Please don't cull the CC-list. On Wed, Jun 15, 2011 at 3:38 PM, Barthus <magnus.kallstrom@gmail.com> wrote: > >> This kind of question is usually better to ask on the main Git mailing >> list, as it's not really Windows specific. > > I found a similar (older) thread in the git-mailing-list, discussing > the same issue. This led me to try cloning the same repository on a > Linux-machine - with success. Linux (at least my distro - Ubuntu) > handles trailing spaces in directory names. > > Isn't this a msysgit-issue? (I just want to make sure that I don't > spend my (and your) time in the wrong place) If it works on Linux then yes, it's probably a Git for Windows issue. Some quick testing reveals that paths can have a trailing space on Linux, but not on Windows. It sounds to me like you need to modify the refname subroutine in git-svn.perl to escape this. Something like this seems to work for me: ---8<--- diff --git a/git-svn.perl b/git-svn.perl index 7849cfc..7a44145 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2126,6 +2126,9 @@ sub refname { # @{ becomes %40{ $refname =~ s{\@\{}{%40\{}g; + # trailing space is not not allowed on Windows + $refname =~ s{ $}{%20}; + return $refname; } ---8<--- If it works for you, I'll submit a proper patch for it. ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <b8767de1-ab2c-4d2a-9024-9ad9b29c614d@j9g2000vbs.googlegroups.com>]
* Re: [msysGit] Re: Trailing spaces in branchname (git-svn) [not found] ` <b8767de1-ab2c-4d2a-9024-9ad9b29c614d@j9g2000vbs.googlegroups.com> @ 2011-06-15 14:38 ` Erik Faye-Lund 2011-06-15 21:13 ` Magnus Kallström 0 siblings, 1 reply; 5+ messages in thread From: Erik Faye-Lund @ 2011-06-15 14:38 UTC (permalink / raw) To: Barthus; +Cc: msysGit, Git Mailing List Again, please don't cull the CC-list. When replying, hit "reply all" in your e-mail client. Also, please don't top-post either. It makes it harder for others to follow the discussion. I've corrected the quoting this time. On Wed, Jun 15, 2011 at 4:12 PM, Barthus <magnus.kallstrom@gmail.com> wrote: > On 15 Juni, 16:00, Erik Faye-Lund <kusmab...@gmail.com> wrote: >> Please don't cull the CC-list. >> >> On Wed, Jun 15, 2011 at 3:38 PM, Barthus <magnus.kallst...@gmail.com> wrote: >> >> >> This kind of question is usually better to ask on the main Git mailing >> >> list, as it's not really Windows specific. >> >> > I found a similar (older) thread in the git-mailing-list, discussing >> > the same issue. This led me to try cloning the same repository on a >> > Linux-machine - with success. Linux (at least my distro - Ubuntu) >> > handles trailing spaces in directory names. >> >> > Isn't this a msysgit-issue? (I just want to make sure that I don't >> > spend my (and your) time in the wrong place) >> >> If it works on Linux then yes, it's probably a Git for Windows issue. >> >> Some quick testing reveals that paths can have a trailing space on >> Linux, but not on Windows. It sounds to me like you need to modify the >> refname subroutine in git-svn.perl to escape this. Something like this >> seems to work for me: >> ---8<--- >> diff --git a/git-svn.perl b/git-svn.perl >> index 7849cfc..7a44145 100755 >> --- a/git-svn.perl >> +++ b/git-svn.perl >> @@ -2126,6 +2126,9 @@ sub refname { >> # @{ becomes %40{ >> $refname =~ s{\@\{}{%40\{}g; >> >> + # trailing space is not not allowed on Windows >> + $refname =~ s{ $}{%20}; >> + >> return $refname; >> } >> >> ---8<--- >> If it works for you, I'll submit a proper patch for it. > > Ok, thanks. I'll try as soon as possible (will be away for a few > days...) > You might want to try this patch instead, as it deals with refnames like "foo /bar" and "foo \bar" also: diff --git a/git-svn.perl b/git-svn.perl index 7849cfc..54894e4 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2126,6 +2126,9 @@ sub refname { # @{ becomes %40{ $refname =~ s{\@\{}{%40\{}g; + # trailing space is not not allowed on Windows + $refname =~ s{ (?=/|\\|$)}{%20}g; + return $refname; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Re: Trailing spaces in branchname (git-svn) 2011-06-15 14:38 ` [msysGit] " Erik Faye-Lund @ 2011-06-15 21:13 ` Magnus Kallström 2011-06-21 22:16 ` Magnus Kallström 0 siblings, 1 reply; 5+ messages in thread From: Magnus Kallström @ 2011-06-15 21:13 UTC (permalink / raw) To: kusmabite; +Cc: msysGit, Git Mailing List [-- Attachment #1: Type: text/plain, Size: 823 bytes --] (I hope I get it right now - previously I used Googles web-interface, and I just couldn't find a way to respond to all. Trying from my email client instead now... I have even read the 'Welcome post' again :) ) Unfortunately, the patch didn't work. This is the error I get when it aborts: Found branch parent: (refs/remotes/CR3533 sökning pÃ¥ fakturabelopp ) be4dd98d152d82f098b90089f4df6a2d411d84e1 fatal: Unable to create 'd:/Dev/GIT/svk/KOB/.git/svn/refs/remotes/CR3533 sökning på fakturabelopp /index.lock': No such file or directory read-tree be4dd98d152d82f098b90089f4df6a2d411d84e1: command returned error: 128 The patch itself is probably working for other parts, and I even tried a similar patch back in March. I never managed to figure out where the call to the locking-function got it's path though. [-- Attachment #2: Type: text/html, Size: 2377 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: Trailing spaces in branchname (git-svn) 2011-06-15 21:13 ` Magnus Kallström @ 2011-06-21 22:16 ` Magnus Kallström 0 siblings, 0 replies; 5+ messages in thread From: Magnus Kallström @ 2011-06-21 22:16 UTC (permalink / raw) To: kusmabite; +Cc: msysGit, Git Mailing List [-- Attachment #1: Type: text/plain, Size: 1962 bytes --] 2011/6/15 Magnus Kallström <magnus.kallstrom@gmail.com> > (I hope I get it right now - previously I used Googles web-interface, and I > just couldn't find a way to respond to all. Trying from my email client > instead now... I have even read the 'Welcome post' again :) ) > > Unfortunately, the patch didn't work. > > This is the error I get when it aborts: > Found branch parent: (refs/remotes/CR3533 sökning pÃ¥ fakturabelopp ) > be4dd98d152d82f098b90089f4df6a2d411d84e1 > fatal: Unable to create 'd:/Dev/GIT/svk/KOB/.git/svn/refs/remotes/CR3533 > sökning på fakturabelopp /index.lock': No such file or directory > read-tree be4dd98d152d82f098b90089f4df6a2d411d84e1: command returned error: > 128 > > The patch itself is probably working for other parts, and I even tried a > similar patch back in March. I never managed to figure out where the call to > the locking-function got it's path though. > Hi again! I have now successfully cloned "my" repository with the following changes in git-svn.perl. I'm not sure if the change in "sub refname" is needed, but I will try to reproduce the error when I find the time for it (the full clone fails after 2-3 days). I can't tell if it breaks anything else, but as far as I can tell, the clone is working. Does it look as if the modification is done in the right place? /Magnus ---8<--- diff --git a/git-svn.perl b/git-svn.perl index 7849cfc..c5e2d23 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2126,6 +2126,9 @@ sub refname { # @{ becomes %40{ $refname =~ s{\@\{}{%40\{}g; + # trailing space is not not allowed on Windows + $refname =~ s{ (?=/|\\|$)}{%20}g; + return $refname; } @@ -3883,6 +3886,7 @@ sub _new { } $_[3] = $path = '' unless (defined $path); + $dir =~ s{ (?=/|\\|$)}{%20}g; mkpath([$dir]); bless { ref_id => $ref_id, dir => $dir, index => "$dir/index", ---8<--- [-- Attachment #2: Type: text/html, Size: 3745 bytes --] ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-21 22:50 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <0014af8a-3b24-4398-88aa-7a3e460f2283@s11g2000yqh.googlegroups.com> 2011-03-24 21:26 ` [msysGit] Trailing spaces in branchname (git-svn) Erik Faye-Lund [not found] ` <12ada6de-4345-4259-b832-371a74df9775@l6g2000vbn.googlegroups.com> 2011-06-15 14:00 ` Erik Faye-Lund [not found] ` <b8767de1-ab2c-4d2a-9024-9ad9b29c614d@j9g2000vbs.googlegroups.com> 2011-06-15 14:38 ` [msysGit] " Erik Faye-Lund 2011-06-15 21:13 ` Magnus Kallström 2011-06-21 22:16 ` Magnus Kallström
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).