使用子目录的路径作为svn:ignore属性

huangapple go评论43阅读模式
英文:

Use path of subdirectory for svn:ignore property

问题

我只想设置项目根目录中的 svn:ignore 属性,这样我只需要跟踪一个地方。所以我尝试包括 test/test_samples/*_dex.txt,但是当我尝试提交时,该文件仍然列在非版本控制下。

为了证明一般来说,我只在 test/test_samples 目录中包括 *_dex.txt,这按预期工作。我还尝试了 / 和 \,因为我在Windows上工作。

还有其他解决方法吗?

英文:

I only want to set the svn:ignore property in the project root directory, so I only have to keep track of one place. So I tried to include test/test_samples/*_dex.txt, but the file is still listed under non-versioned when I try to commit.

To prove that generally speaking I included *_dex.txt only in the test/test_samples directory, which worked as expected. I also tried / and , as I am working on Windows.

Any other idea how to solve this?

答案1

得分: 1

Subversion期望您在每个目录中设置文件名或通配符。因此,在项目的根目录中设置路径将不起作用。

引用自《忽略未版本化的项目》(重点在于我):

另一种方式(即设置svn:ignore)利用了Subversion的目录属性支持[...]。这两种机制都使用文件模式(一系列用于匹配文件名的文字和特殊通配符字符)来决定要忽略哪些文件。

虽然它没有说明svn:ignore属性从父目录继承,但唯一明确继承的属性是svn:mergeinfo(请参阅Mergeinfo)。

我猜测Subversion只是查看当前目录的svn:ignore属性,而不费心去查找上级目录。

为了完整起见,还有全局忽略模式(主要用于编辑器的备份和交换文件)。在您的情况下,这些似乎不太可能是一个好的解决方案。

因此,您将不得不选择分散的解决方案,并在目录test/test_samples上设置svn:ignore属性为*_dex.txt

英文:

Subversion expects you to set file names or wildcards per directory. So setting a path in the project's root will not work.

Quoting from Ignoring Unversioned Items in the Red Bean Book (emphasis mine):
> The other way [i.e. setting svn:ignore] makes use of Subversion's directory property support [...]. Both of the mechanisms use file patterns (strings of literal and special wildcard characters used to match against filenames) to decide which files to ignore.

While it does not state that the svn:ignore property was not inherited from parent directories, the only property that is explicitly inherited is svn:mergeinfo (see Mergeinfo)

I would guess that subversion simply looks at the svn:ignore property of the current directory without bothering to go up the tree.

For the sake of completeness, there are also global ignore patterns (mostly used for editors' backup and swap files). It seems unlikely these are a good solution in your case.

So you will have to go for the decentralized solution and set the svn:ignore property on directory test/test_samples to *_dex.txt.

huangapple
  • 本文由 发表于 2023年5月24日 19:24:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76323018.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定