svn-all-fast-export / svn2git

:octopus: A fast-import based converter for an svn repo to git repos
GNU General Public License v3.0
261 stars 100 forks source link

empty-dirs doesn't respect filters (during merges?) #120

Open Creat opened 3 years ago

Creat commented 3 years ago

I ran into an issue where I have both --empty-dirs and ignore filters/rules active. The problem now is that during a merge, empty folders are still recreated despite the path matching an action ignore rule. I'm not entirely sure if this also applies on the initial commit of a folder that matches an ignore rule, but includes empty directories.

The specific problem case is that we unfortunately have multiple git-repositories committed into the svn repository that's being converted. This means it contains .git-folders. Obviously I have to exclude those, since git repositories can't contain .git folders for obvious reason. I have a rule that ignores any .git folder, anywhere and always. Still on a merge there are empty folder (re-created with a .gitignore despite the fact that they should be ignored. Typically, in trivial repositories, .git\objects\info and .git\refs\tags might well be empty. And those promptly get recreated despite the rest of the .git contents being correctly ignored.

The ignore rule looks as follows (maybe slightly overcomplicated, but hey it works). It obviously occurs before any rule that assigns a path to a repository/branch and as previously stated the path is otherwise ignored correctly with .gitignore files for empty-dirs being the only exception.

match /([^/]+/)+\.git/
    action ignore
end match

I tried to find and fix the occurrence in the source, but couldn't quickly and reliably identify the point in svn.cpp where this decision is made (or how to respect filters that may exist).