Skip to content

Instantly share code, notes, and snippets.

@pfdevmuller
Created April 3, 2013 11:18
Show Gist options
  • Save pfdevmuller/5300352 to your computer and use it in GitHub Desktop.
Save pfdevmuller/5300352 to your computer and use it in GitHub Desktop.
Patch to svn2git that makes it work in Windows for repositories with spaces in the name.
From 6b679b2d1c9918fc817ddcf6e5dbd2bc4d28330a Mon Sep 17 00:00:00 2001
From: Pieter Muller <pfdevmuller@gmail.com>
Date: Wed, 3 Apr 2013 12:54:54 +0200
Subject: [PATCH] Hacked to work with repo names with spaces on Win
I wrapped the arguments for the generated git commands in quotations,
and removed the code replacing spaces with escaped spaces.
I don't know if this will work on Linux, I only tested it on Windows.
---
lib/svn2git/migration.rb | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb
index 30c078c..9cc93ed 100644
--- a/lib/svn2git/migration.rb
+++ b/lib/svn2git/migration.rb
@@ -15,8 +15,8 @@ module Svn2Git
verify_working_tree_is_clean
else
show_help_message('Missing SVN_URL parameter') if args.empty?
- show_help_message('Too many arguments') if args.size > 1
- @url = args.first.gsub(' ', "\\ ")
+ show_help_message('Too many arguments') if args.size > 1
+ @url = args.first
end
end
@@ -157,7 +157,7 @@ module Svn2Git
if nominimizeurl
cmd += "--no-minimize-url "
end
- cmd += "--trunk=#{@url}"
+ cmd += "--trunk=\"#{@url}\""
run_command(cmd)
else
@@ -169,11 +169,11 @@ module Svn2Git
if nominimizeurl
cmd += "--no-minimize-url "
end
- cmd += "--trunk=#{trunk} " unless trunk.nil?
- cmd += "--tags=#{tags} " unless tags.nil?
- cmd += "--branches=#{branches} " unless branches.nil?
+ cmd += "--trunk=\"#{trunk}\" " unless trunk.nil?
+ cmd += "--tags=\"#{tags}\" " unless tags.nil?
+ cmd += "--branches=\"#{branches}\" " unless branches.nil?
- cmd += @url
+ cmd += "\"#{@url}\""
run_command(cmd)
end
--
1.8.1.msysgit.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment