I have created a simple script to migrate fairly large SVN repository. Instead of using git svn clone
, I am using git svn init
and git svn fetch
so that I could specify the revision and fetch it chunk by chunk. More or less, it is something like this:
while [ "$CURRENT_REVISION" -lt "$MAX_REVISION" ]; do
END_REVISION=$((CURRENT_REVISION + 100))
if [ "$END_REVISION" -ge "$MAX_REVISION" ]
then
END_REVISION=$MAX_REVISION
fi
git svn fetch -r "$CURRENT_REVISION":"$END_REVISION" --authors-file="$AUTHORS_FILE"
#increasing the current and end revision
CURRENT_REVISION=$END_REVISION
END_REVISION=$((CURRENT_REVISION + 100))
done
However, I understand that by default the behavior of the fetch/clone will not retain empty directories. Thus, I might need to manually check in those empty directories (*which I'm trying to avoid).
There is a --preserve-empty-dirs
parameter in the git svn clone
but not in git svn fetch
.
Is there any workaround to trick this out?
UPDATE
Even though it is not mentioned in the official documentation that we can use the config key for the fetch, it is actually works
There is detailed explanation by @Vampire related to this question. So I'll simplify this.
After doing the init repository, I had to change the configuration of my remote branch:
git config svn-remote.<remote name>.preserve-empty-dirs "true"
git config svn-remote.<remote name>.placeholder-filename ".gitkeep"
You can verify the configuration by looking at /.git/config. Just do normal fetch and your directory will be preserved.