Git-svn W: -empty_dir 警告。它们是什么意思?

发布于 2024-10-01 18:49:51 字数 485 浏览 3 评论 0原文

在尝试使用标准布局使用 git-svn 克隆现有 Subversion 存储库时,我收到了一堆 W: -empty_dir (和 W: +empty_dir)警告。克隆的 git 存储库似乎正在工作,即我可以执行常规的 git 操作并提交到 SVN 存储库。

真正的问题是,初始克隆和变基会在存储库顶部(以及主干中的其他目录)创建一些 SVN 存储库中不存在的空目录。这些目录不包含任何文件,只包含一些空目录。看来“W: -empty_dir”警告对应于这些空目录。

我通过使用 SVN 检查整个存储库来查找空目录,但没有空目录。我还通过 SVN 检查了存储库中是否有具有特殊属性的文件,但除了“可执行文件”和“mime-type”之外没有其他文件。

现有的存储库最初并不遵循标准布局,但我对其进行了清理,以便顶级目录只是“trunk”、“tags”和“branches”。

是什么原因导致创建这些 Subversion 下不存在的空目录?

While trying to clone an existing Subversion repository using git-svn using standard layout, I got a bunch of W: -empty_dir (and W: +empty_dir) warnings. The cloned git repository seems to be working, i.e. I can do usual git operations and dcommit to SVN repository.

The real problem is that the initial clone and rebase create some empty directories that do not exist in SVN repository, at the top of the repository (along with other directories in trunk). These directories contain no file but just some empty directories inside them. It seems that the "W: -empty_dir" warnings correspond to these empty directories.

I looked for empty directories by checking out the whole repository using SVN, but there is no empty directory. I also checked through SVN if the repository has files with special properties, but there was not any other than "executable" and "mime-type".

The existing repository was not originally following the standard layout, but I cleaned it up so that the top directories are just "trunk", "tags", and "branches".

What can be causing the creation of these empty directories that do not exist under Subversion?

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

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

发布评论

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

评论(3

巴黎夜雨 2024-10-08 18:49:51

如果不知道这些空目录的确切来源,您可以使用 --rmdir 命令行选项或 svn.rmdir< 告诉 git-svn 删除它们。 /code> 配置选项。

请参阅 git-svn OPTIONS 手册页和

如果没有留下任何文件,请从 SVN 树中删除目录。
SVN 可以对空目录进行版本控制,如果其中没有文件,则默认情况下不会删除它们。 git 无法对空目录进行版本控制。
启用此标志将使对 SVN 的提交像 git 一样。


该警告来自 git-svn 不支持的 SVN 标签(即“目录”),如“git svn 中断,然后我丢失了所有标签,如何修复它?”。
来自此帖子

SVN 跟踪目录,而 git 不跟踪,因此空目录无法在 git 中表示。
这些关于文件的警告似乎告诉您哪些文件被删除,导致在导入的特定 svn commit 中留下一个空目录。

-empty_dir+empty_dir 之间的区别在于空目录在 SVN 存储库中的显示方式

-empty_dir

一堆文件被删除,留下一个目录(分支或标签)为空。

+empty_dir

正在导入的 SVN 修订版中刚刚创建了一个空分支或标签,并且 git-svn 不会导入空目录。


请注意,您可以在出现警告后重新启动导入

Without knowing exactly where those empty directories came from, you could tell git-svn to remove them by using the --rmdir command line option or svn.rmdir configuration option.

See git-svn OPTIONS man page and

Remove directories from the SVN tree if there are no files left behind.
SVN can version empty directories, and they are not removed by default if there are no files left in them. git cannot version empty directories.
Enabling this flag will make the commit to SVN act like git.


The warning comes from SVN tags (which are "directories") not supported by git-svn, as in "git svn interrupted, then I lost all the tags, how to fix it?".
From this thread:

SVN tracks directories, git doesn't, so empty directories cannot be represented in git.
Those warnings on files seem to tell you which files that got deleted, causing an empty directory to be left in place, in that particular svn commit being imported.

The difference between -empty_dir and +empty_dir is about how the empty directory appears in the SVN repo:

-empty_dir

A bunch of files are deleted, leaving a directory (branch or tag) empty.

+empty_dir

An empty branch or tag has just been created in the SVN revision being imported, and git-svn won't import an empty directory.


Note that you can restart the import after that warning.

一指流沙 2024-10-08 18:49:51

git 的特点之一是它不跟踪目录。这都是关于 git 中的内容(文件)。因此,空目录几乎会在本地存储库中闲置。删除本地存储库中的空目录的最佳方法是执行 git clean -d。

查看 man git clean 以获取更多信息。

One of the things with git is that it does not track directories. It is all about content (files) in git. So empty directories are pretty much left to languish in your local repo. The best way to get rid of empty directories in your local repo is to do git clean -d.

Checkout man git clean for more info.

我很OK 2024-10-08 18:49:51

关于标题中的问题(这就是吸引谷歌注意此页面的原因),根据我的发现,使用 git-svn 1.7.1 或 git 1.8.5:警告 W: -empty_dir: x /y/z 表示文件或文件夹 x/y/z 已在 SVN 变更集中删除。除非您指定 -q (--quiet),否则该事实已报告为 D x/y/z。我认为它试图表达的是,因此,文件夹 x/y 可能已变为空,因此已从 git 视图中删除。更常见的是 x/y 没有变空并且没有什么奇怪的事情发生。

实际上,如果删除 x/y/z 会使 x/y 为空,那么您可能会删除 SVN 变更集中的整个 x/y,并且甚至不会单独报告 x/y/z 的删除。因此,您不会收到该警告,而是 W: -empty_dir: x/y 警告您 x 可能已变为空,而您知道它没有变为空,因为那样您就会删除 x.. )

另一方面,如果您确实留下了空目录并希望保留它们,我想您会使用 --preserve-empty-dirs 并且我认为警告也没有意义(如果在这种情况下仍然出现 。

简而言之,忽略它。与 W:+empty_dir 不同,这是一个不同的故事。

Regarding the question in the title (which is what draws google's attention to this page), according to my findings, using either git-svn 1.7.1 or git 1.8.5: the warning W: -empty_dir: x/y/z means that the file or folder x/y/z was removed in the SVN changeset. Unless you specified -q (--quiet), that fact was already reported as D x/y/z. What I think it tries to say is that as a consequence, the folder x/y might have become empty and was therefore removed from the git view. It is far more common that x/y did not become empty and there is nothing peculiar going on.

In practice, if removing x/y/z would have left x/y empty, you would probably have removed the whole of x/y in the SVN changeset, and the removal of x/y/z would not even be reported separately. So you would not get that warning, but instead W: -empty_dir: x/y warns you that x might have become empty, which you know it didn't because then you would have deleted x...

If, on the other hand, you did leave empty directories around and want to keep them, I guess you would use --preserve-empty-dirs and I see no point in the warning either (if it still appears in that case).

So in short, ignore it. Unlike W: +empty_dir, which is a different story.

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