Reputation: 7510
I have a specific problem I did not find a solution for, here or anywhere else. I have a Subversion repository and I am using git-svn to access it and work on it.
Some time ago, there were some empty directories in the Subversion repository (empty, only subfolders). Git does not track those. Then they were deleted from the Subversion repository. But I still have them even after running this command:
git svn rebase
And when I delete them by hand, they are recreated during the next command:
git svn rebase
How can I get rid of them?
I checked using pure Subversion and they are not in the repository.
Upvotes: 15
Views: 7508
Reputation: 20843
Tell git svn
that it should not try to recreate empty directories:
git config svn-remote.svn automkdirs false
This is the relevant section of the man page:
svn-remote.<name>.automkdirs
Normally, the "git svn clone" and "git svn rebase" commands attempt to recreate empty directories that are in the Subversion repository. If this option is set to "false", then empty directories will only be created if the "git svn mkdirs" command is run explicitly. If unset, git svn assumes this option to be "true".
Note that it is easy to confuse this topic with the topic of committing/not committing empty directories to SVN (which is what svn.rmdir
is for).
Upvotes: 4
Reputation: 7332
Answer via https://spin.atomicobject.com/2014/08/17/git-svn-empty-directories/:
Modify your ~/.gitconfig
to add this as default behaviour.
[svn]
# push empty directory removals back to svn as directory deletes
rmdir = true
This will make removing directories the default.
Upvotes: 3
Reputation: 2372
I think you'll find your answer in this blog post.
[...]
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.
config key: svn.rmdir
To fix the root of the problem set the git config globally:
git config --global svn.rmdir true
[...]
Upvotes: 16
Reputation: 75
It is a bit rough, but I have found that the following solves my problem:
rm .git/svn/refs/remotes/trunk/unhandled.log
git clean -df
Any subsequent
git svn rebase
will not recreate anything.
Since I don't know how to regenerate this file without re-cloning the repo, I suggest making a backup of it first. It is a text file, so I suppose you could also edit its content to remove the entries that end up creating
Upvotes: 1