简体   繁体   English

git-svn dcommit失败,因为存储库名称包含空格

[英]git-svn dcommit fails because the repository name contains a space

When attemping to git svn dcommit to a repository that has spaces in it's name, I get the following error: 当尝试将git svn dcommit发送到其名称中包含空格的存储库时,我收到以下错误:

Committing to http://svn.kuluvalley.com/Meet the Expert/trunk ...
http://svn.kuluvalley.com/Meet the Expert/trunk
Filesystem has no item: '/!svn/bc/7397/Meet' path not found at /usr/libexec/git-core/git svn line 592

It looks like git svn doesn't support directories with spaces in them. 看起来git svn不支持带空格的目录。

I was able to work around the problem of git svn not working for repositories with spaces in them by patching git-svn. 通过修补git-svn,我能够解决git svn不能用于存储空间的存储库的问题。

I updated the url_path function to: 我将url_path函数更新为:

sub url_path { 
  my ($self, $path) = @_; 

  my $url = $self->{url} . '/' . $self->repo_path($path); 
  if ($self->{url} =~ m#^https?://#) { 
    $url =~ s!([^~a-zA-Z0-9_./-])!uc sprintf("%%%02x",ord($1))!eg; 
    $url =~ s!^(https?)%3A//!$1://!; 
  } 
  $url 
} 

For windows (x64) users, this function can be found in Editor.pm file, which is located in 对于windows(x64)用户,可以在Editor.pm文件中找到此函数,该文件位于

{Git installation folder}\\mingw64\\share\\perl5\\site_perl\\Git\\SVN\\ {Git安装文件夹} \\ mingw64 \\ share \\ perl5 \\ site_perl \\ Git \\ SVN \\

This ensures that the spaces in the url are encoded correctly. 这可确保url中的空格被正确编码。

It seems to work for me, but hasn't been tested thoroughly. 它似乎对我有用,但尚未经过彻底测试。

I believe the problem with spaces is fixed in Git >= 1.8.0 (See: #786942 ). 我相信空格的问题在Git> = 1.8.0中修复(参见: #786942 )。

So you should consider to upgrade it. 所以你应该考虑升级它。

See GitHub Home page: https://github.com/git/git 请参阅GitHub主页: https//github.com/git/git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM