【问题标题】:git-svn dcommit fails because the repository name contains a spacegit-svn dcommit 失败,因为存储库名称包含空格
【发布时间】:2011-11-26 22:18:13
【问题描述】:

当尝试 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

看起来git svn 不支持包含空格的目录。

【问题讨论】:

标签: git svn spaces dcommit


【解决方案1】:

通过修补 git-svn,我能够解决 git svn 不适用于其中包含空格的存储库的问题。

我将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 
} 

对于 windows (x64) 用户,此功能可以在 Editor.pm 文件中找到,该文件位于

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

这样可以确保 url 中的空格被正确编码。

它似乎对我有用,但尚未经过彻底测试。

【讨论】:

    【解决方案2】:

    我相信空格问题在 Git >= 1.8.0 中已得到解决(参见:#786942)。

    所以你应该考虑升级它。

    参见 GitHub 主页:https://github.com/git/git

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-16
      • 2010-10-18
      • 2015-08-28
      • 2020-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多