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

标签 git svn spaces dcommit

当尝试 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 来解决 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 installation folder}\mingw64\share\perl5\site_perl\Git\SVN\

这确保了 url 中的空格被正确编码。

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

关于git-svn dcommit 失败,因为存储库名称包含空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7584605/

相关文章:

git filter-branch 只获取更改的文件?

svn - 如何确定 SVN 工作副本布局版本?

javascript - 如何计算 JQuery 或 Javascript 中一对标签内的字符数(不包括空格)?

git - 从 git 1.9.5 升级到最新的 2.6 我需要注意什么?

Git:强制 pull 以覆盖本地更改

git - .bashrc 未被 git bash 读取 git 2.5.1

svn - 从 SVN 迁移到 TFS

maven - tmatesoft.svn.core.SVNAuthenticationException : svn: E170001

BASH shell 用变量中的空格扩展参数

JAVA CSV 写空格不带引号