git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [msysGit] Re: Trailing spaces in branchname (git-svn)

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Jun 15, 2011, 14:38 UTC
Message-ID
<BANLkTikgF53tKbUsJJznENAiW8Smm5ePPA@mail.gmail.com>
In-Reply-To
<b8767de1-ab2c-4d2a-9024-9ad9b29c614d@j9g2000vbs.googlegroups.com>

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:
Show 43 quoted lines
> 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;
 }
Previous: Erik Faye-LundNext: Magnus Kallström
Message 3 of 5 in “Re: [msysGit] Trailing spaces in branchname (git-svn)”
  1. Erik Faye-LundMar 24, 2011
  2. Erik Faye-LundJun 15, 2011
  3. Erik Faye-LundJun 15, 2011
  4. Magnus KallströmJun 15, 2011
  5. Magnus KallströmJun 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.