"git svn" 命令失败 "Value is not a string (or undef) at /usr/share/perl5/vendor_perl/Git/SVN/Ra.pm line 96"

"git svn" commands fail with "Value is not a string (or undef) at /usr/share/perl5/vendor_perl/Git/SVN/Ra.pm line 96"

我有一个 git 存储库,使用 git svn clone 从上游 SVN 存储库创建。存储库是在一段时间前(1 或 2 年)创建和配置的。拉动 (git svn fetch/git svn rebase) 和推动 (git svn dcommit) 之前工作正常。我已经停止使用存储库几个月了,现在使用这些命令中的任何一个都失败了:

Value is not a string (or undef) at /usr/share/perl5/vendor_perl/Git/SVN/Ra.pm line 96

所以我无法使用 git-svn。我怎样才能让它重新工作?

我是 运行 Arch Linux 所以很有可能是 Subversion 或 Git 的更新以某种方式破坏了我的设置。但是,我在搜索错误消息时没有找到任何相关内容。 有问题的 perl 行在我当前的 git 版本中看起来像这样(因为第 96 行在其他版本中可能不同):

SVN::_Core::svn_auth_set_parameter($baton,
    $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
    bless ($dont_store_passwords, "_p_void"));

我目前使用的是 subversion 1.9.2 和 git 2.6.1

编辑:在 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797705

中跟踪了同样的问题

我仍然不确定哪个软件需要更改(如果有的话),但是使用 perl 代码我可以查明问题出在我的配置上。

为了防止颠覆存储我在 ~/.subversion/config:

中的密码
[auth]
store-passwords = no

注释行 (# store-passwords = no) 使 git svn 再次工作。 从 subversion 1.6 开始,在文件 config 中指定此设置是 deprecated(但有效)。 然而,subversion 1.9.x(可能从 1.9 开始)似乎完全删除了这个选项(我找不到 1.9 文档,http://svnbook.red-bean.com 仍然以 1.8 为特色 "nightly")。这并没有破坏颠覆,但它确实破坏了我的 git svn

从 Subversion 1.6 开始,这个选项可以在 ~/.subversion/servers 中给出:

[global]
store-passwords = no

这可能是由 git-svn 触发的颠覆 perl 文件中的错误。但是,我的 perl 不够流利,无法就此做出很好的错误报告。此外,我的配置是错误的(对于 subversion 1.9),如果它没有以某种方式中断,我就不会发现这一点。不过,以 "better" 的方式破解可能会很好。

编辑: git-svn 的补丁现在可以在 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797705;msg=15

Git 2.7.1 应该很快(2016 年 2 月)解决这个问题。

参见 commit 0b66415 (16 Jan 2016) by Eric Wong (ele828)
(由 Junio C Hamano -- gitster -- in commit 6d579a0 合并,2016 年 2 月 1 日)

git-svn:修复 SVN 1.9.0+

上的 auth 参数处理

For users with "store-passwords = no" set in the "[auth]" section of their ~/.subversion/config, SVN 1.9.0+ would fail with the following message when attempting to call svn_auth_set_parameter:

Value is not a string (or undef) at Git/SVN/Ra.pm

Ironically, this breakage was caused by r1553823 in subversion:

"Make svn_auth_set_parameter() usable from Perl bindings."

Since 2007 (602015e), git-svn has used a workaround to make svn_auth_set_parameter usable internally.
However this workaround breaks under SVN 1.9+, which deals properly with the type mapping and fails to recognize our workaround.

For pre-1.9.0 SVN, we continue to use the existing workaround for the lack of proper type mapping in the bindings.

Tested under subversion 1.6.17 and 1.9.3.

I've also verified r1553823 was not backported to SVN 1.8.x:

BRANCH=http://svn.apache.org/repos/asf/subversion/branches/1.8.x
svn log -v $BRANCH/subversion/bindings/swig/core.i

参考:https://bugs.debian.org/797705