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

发布于 2024-12-07 03:56:42 字数 325 浏览 4 评论 0原文

当尝试 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 不支持其中包含空格的目录。

When attemping to git svn dcommit to a repository that has spaces in it's name, I get the following error:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽你眉间 2024-12-14 03:56:42

我能够通过修补 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 中的空格编码正确。

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

I was able to work around the problem of git svn not working for repositories with spaces in them by patching git-svn.

I updated the url_path function to:

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

{Git installation folder}\mingw64\share\perl5\site_perl\Git\SVN\

This ensures that the spaces in the url are encoded correctly.

It seems to work for me, but hasn't been tested thoroughly.

温柔嚣张 2024-12-14 03:56:42

我相信空格问题已在 Git >= 1.8.0 中修复(请参阅:#786942)。

所以你应该考虑升级它。

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

I believe the problem with spaces is fixed in Git >= 1.8.0 (See: #786942).

So you should consider to upgrade it.

See GitHub Home page: https://github.com/git/git

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文