nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

"--exclude" option does not work on Windows in git shell, using bash #121

Open aschofer opened 11 years ago

aschofer commented 11 years ago

I am using a Windows box (Windows 7), and I:

Then, I started up the git shell (in bash mode). Running any svn2git command without using the "--exclude" option works perfectly. Running it with the "---exclude" command fails. The error I get (in verbose mode) says:

Running command: git svn fetch '--ignore-paths=^(?:trunk[/]|branches[/][^/]+[/])
(?:api-consolidation)'
'branches[' is not recognized as an internal or external command,
operable program or batch file.
command failed:
2>&1 git svn fetch '--ignore-paths=^(?:trunk[/]|branches[/][^/]+[/])(?:api-conso
lidation)'

I fixed this locally by modifying migration.rb, line 199. I changed it from:

cmd += "'--ignore-paths=#{regex}'"

to

cmd += "\"--ignore-paths=#{regex}\""
nirvdrum commented 11 years ago

Is this a PowerShell vs CMD.exe issue?

FeeJai commented 11 years ago

I cannot reproduce this on here — Sent from Mailbox for iPhone

On Fri, May 10, 2013 at 1:04 AM, Kevin Menard notifications@github.com wrote:

Is this a PowerShell vs CMD.exe issue?

Reply to this email directly or view it on GitHub: https://github.com/nirvdrum/svn2git/issues/121#issuecomment-17695340

aschofer commented 11 years ago

When you download “Github for Windows”, you can run the “git shell” in 3 modes:

While I normally use “Git Bash” (and that is where I first saw the error), I got the same error with “PowerShell”. I never tried it with Cmd.

Alex

nirvdrum commented 11 years ago

Okay. I've just seen PowerShell and cmd handle special characters differently, so I wanted to check.

nathannis commented 11 years ago

I had the same issue and modifying the migration.rb as aschofer suggested worked for me.

ikari-pl commented 11 years ago

I have this error with a regular cmd window (didn't test other ones).

ghost commented 11 years ago

Perfect. Thanks for sharing this.

HNygard commented 10 years ago

I had the same bug in last week and submitted the pull request #153. I now found this issue which has the same fix as I submitted.

nirvdrum commented 10 years ago

This seems innocuous enough to merge. But I'm confused why it would be a git-bash problem. Does anyone have any insights as to why changing the quoting would be significant?

marcovtwout commented 10 years ago

I have a similar problem in both CMD.exe as in PowerShell:

PS S:\test> svn2git http://xxxxxx.googlecode.com/svn --exclude wiki
'tags[' is not recognized as an internal or external command, operable program or batch file.
command failed:
2>&1 git svn fetch '--ignore-paths=^(?:trunk[/]|tags[/][^/]+[/]|branches[/][^/]+[/])(?:wiki)'
alexeld commented 10 years ago

Hi folks, I encountered this issue with Git Bash on Windows, applied the change suggested by @aschofer (from @HNygard's PR) and it fixed my issue. Is there any chance this change will find its way in to the script any time soon?

nirvdrum commented 10 years ago

When I last tried to merge this, I think it broke on PowerShell. It's been a while since I don't totally recall. If we can get it working in git-bash, cmd, and PowerShell, while not breaking *nix shells, I'd gladly merge it.

alexeld commented 10 years ago

That's a fair point. I've got access to Git Bash, PowerShell, cmd, and Bash v.3.2.51(1) (on OS X) that I'd be happy to test the change on and see what breaks.

I'll come back in a few hours/days with an answer, unless someone beats me to it. :-)

nirvdrum commented 10 years ago

I won't be able to get to this today. But if you can, I'll be happy to look at doing a new release shortly.

nirvdrum commented 10 years ago

@alexeld Any luck with this?

contactrejjy commented 8 years ago

I had same problem and the solution worked for me. @aschofer thanks you saved my day!!