Git-svn W: -empty_dir warnings. What do they mean? Git-svn W: -empty_dir warnings. What do they mean? git git

Git-svn W: -empty_dir warnings. What do they mean?


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.


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.


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.