简体   繁体   English

git-svn 忽略 Windows 上的颠覆配置文件(自动道具)

[英]git-svn ignoring subversion configuration file (auto-props) on Windows

This is my first question here, I hope am not doing anything wrong.这是我在这里的第一个问题,我希望没有做错任何事情。

As the title suggests, I am trying to work with git-svn on a project which has a central SVN repository.正如标题所暗示的,我正在尝试在一个具有中央 SVN 存储库的项目上使用 git-svn。 The SVN repository uses auto-props, and if these are not properly set in the local SVN configuration file, the commit is rejected. SVN 存储库使用自动道具,如果这些在本地 SVN 配置文件中没有正确设置,则提交将被拒绝。

I have read everywhere, including here on StackOverflow, that git-svn is smart enough to read and honor the svn configuration file, so if I already configured my Subversion client properly, git-svn should just work.我已经阅读了所有地方,包括在 StackOverflow 上,git-svn 足够聪明,可以读取和遵守 svn 配置文件,所以如果我已经正确配置了我的 Subversion 客户端,git-svn 应该可以正常工作。 Unfortunately this is not being the case for me.不幸的是,这对我来说并非如此。

Here is the content of my SVN config file, the location if which is C:\\Users[myusername]\\AppData\\Roaming\\Subversion\\config .这是我的 SVN 配置文件的内容,如果是C:\\Users[myusername]\\AppData\\Roaming\\Subversion\\config 的位置 I removed all the comments (and only the comments).我删除了所有评论(只有评论)。

[auth]

[helpers]

[tunnels]

[miscellany]
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* *.swp ~*
enable-auto-props = yes
use-commit-times = yes

[auto-props]
*.e = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.c = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.h = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.cpp = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.y = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.py = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.ecf = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.xace = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.ace = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.ge = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.eant = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.bm = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.bat = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.sh = svn:keywords=Author Date ID Revision;svn:eol-style=native
*.xeb = svn:keywords=Author Date ID Revision;svn:eol-style=native
Mak* = svn:keywords=Author Date ID Revision;svn:eol-style=native
tcf = svn:eol-style=native
output = svn:eol-style=native
output? = svn:eol-style=native

Committing with SVN works perfectly, and it stops working (the server rejects it saying that a required auto-prop is not set) if I edit this file and set enable-auto-props to no , so this is the right file to edit and it is being parsed.如果我编辑此文件并将enable-auto-propsno ,则使用 SVN 提交工作完美,并且它停止工作(服务器拒绝它说没有设置所需的自动道具),所以这是正确的文件编辑和它正在被解析。 Sadly, git-svn ignores this entirely, and Dcommitting always fail with the same error message, which is the following:遗憾的是,git-svn 完全忽略了这一点,并且 Dcommitting 总是失败并显示相同的错误消息,如下所示:

ERROR from SVN:
A repository hook failed: MERGE request failed on '/[url omitted]/Src': Commit blocked by pre-commit hook (exit code 1) with output:
Props 'svn:keywords=author date id revision' missing (or not expected)
Props 'svn:eol-style=native' missing (or not expected)
Props issue on: /[url omitted]/some_file.cpp

this message is repeated several times for all the files with relevant extension that I am trying to commit.对于我尝试提交的具有相关扩展名的所有文件,此消息会重复多次。

I read in a comment to a StackOverflow answer somewhere that on Windows there might be another copy of the Subversion config file, located in "C:\\Users[myusername].subversion\\config", but this wasn't the for me.我在某个 StackOverflow 答案的评论中读到,在 Windows 上可能有另一个 Subversion 配置文件的副本,位于“C:\\Users[myusername].subversion\\config”,但这不适合我。 Just to be sure, I copied the config file to this path and nothing changed.可以肯定的是,我将配置文件复制到此路径并没有任何更改。

I am surprised that this doesn't seem to be a common problem.我很惊讶这似乎不是一个常见问题。 I was expecting to find loads of people asking the same question on the Internet, but this doesn't seem to be the case.我期待在互联网上找到很多人问同样的问题,但事实并非如此。 When people ask about auto-props, the answer is always just that git-svn should be honoring the SVN config file, usually followed by "thank you, it works!", so it is likely to depend on something in my installation, but I don't honestly have a clue of how I can troubleshoot that.当人们询问 auto-props 时,答案总是只是 git-svn 应该尊重 SVN 配置文件,通常后跟“谢谢,它有效!”,所以它可能取决于我安装中的某些东西,但是老实说,我不知道如何解决这个问题。

Thank you for reading and thank you in advance for your help.感谢您的阅读,并提前感谢您的帮助。

Ok, I found the solution.好的,我找到了解决方案。 The guess was that git-svn was ignoring my configuration because it was looking for the configuration file in the wrong place.猜测是 git-svn 忽略了我的配置,因为它在错误的位置寻找配置文件。 I decided I wanted to find where git was actually storing git configuration and I found on stack the command git config --global --edit will do this (it will open an editor, from which you can see where the file is located).我决定要找到 git 实际存储git配置的位置,我在堆栈中发现命令git config --global --edit将执行此操作(它将打开一个编辑器,从中您可以看到文件所在的位置)。

It turned out that, unlike Subversion's, the git configuration was on a network drive on my machine, where my domain user profile is stored.事实证明,与 Subversion 不同的是,git 配置位于我机器上的网络驱动器上,我的域用户配置文件存储在该驱动器上。 I found another copy of the SVN config file on that drive, replaced it with the correct file, and now git-svn works like a charm.我在那个驱动器上找到了另一个 SVN 配置文件的副本,用正确的文件替换了它,现在 git-svn 就像一个魅力。

Even though I believe something on my machine must be improperly configured, this solved my problem.尽管我认为我的机器上的某些东西必须配置不正确,但这解决了我的问题。

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

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