Git-svn W: -empty_dir 警告。它们是什么意思?
在尝试使用标准布局使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果不知道这些空目录的确切来源,您可以使用
--rmdir
命令行选项或svn.rmdir< 告诉 git-svn
删除它们。 /code> 配置选项。请参阅
git-svn
OPTIONS 手册页和该警告来自 git-svn 不支持的 SVN 标签(即“目录”),如“
git svn 中断,然后我丢失了所有标签,如何修复它?
”。
来自此帖子:
-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 orsvn.rmdir
configuration option.See
git-svn
OPTIONS man page andThe 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:
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.
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.
关于标题中的问题(这就是吸引谷歌注意此页面的原因),根据我的发现,使用 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 asD 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.