Page tree
Skip to end of metadata
Go to start of metadata

Excluding Particular Files or File Types

It is worth sometimes to get rid of some unneeded files during SVN to Git translation, like, say, temporary files, some files OS creates, binaries, drive images - in short, all the files that aren't needed for development and that aren't worh to be copied. If such files have to be excluded from everywhere across the SVN project - that is, from any branch and tags - then the PATTERN has to be recursive and we can set the option like this:

excludePath = *.exe
     excludePath = *.bin
     excludePath = *.dl*
     excludePath = ~*
     excludePath = .DS_Store

Such configuration means that SubGit will ignore exe and bin files, all the files with extenstion dl* - e.g. dl, dl, dll etc.; all the files that start with *~.DSStore*. All such files will be excluded, no matter where in SVN porject they reside - they won't appear in Git at all.

If you need to exclude some files from particular SVN directory - that's another story. There's actually no choice but using non-recursive pattern and it's a more complicated than recursive case since it requires all the paths where those files reside to be accounted. Suppose, you have a SVN project layout like this:

/svn
      /repository
         /project
            /trunk
            /branches
                /branch_1
                    /source
                    /bin
                        /test
                        /prod
                        /opt
                    /docs
                        /html
                /branch_2
                    /source
                    /bin
                        /test
                        /prod
                    /docs
                        /html
                …
            /tags

you set whole the project to be translated to Git, but you want not to include some file which reside in bin and docs/html directories - that is, all the files have to be translated but some files in those directories. That means we cannot use recursive PATTERN since it will exclude files everywhere and thus we have to set them exclicitly using non-recursive pattern and the configuration might be set like this:

excludePath = /bin/*.exe
     excludePath = /bin/test/*.exe 
     excludePath = /bin/**/*.dl*   
     excludePath = /docs/html/*.pdf
     excludePath = /**/~*          
     excludePath = .DS_Store

The non-recursive PATTERN provides very deep granularity so we can set exactly what we need. The configuration above tells SubGit not to translate exe files from bin and /bin/test directories, but those from /bin/opt directory will be translated - there's no setting that would say anything about /bin/opt directory. At the same time, by that configuration SubGit is told not to translate dl* files from bin directory and all its subdirectories - the ** pattern portion means a path of any length so both bin itself and all its subdirectories are affected by that setting.

The next settings tells SubGit not to translate pdf files from /docs/html, but pdf from everywhere else will be translated.

Finally, there are the settings that tells not to translate ~* files from branches and DS_Store from everywhere in the SVN project - there's no problem to use both recursive and non-recursive patterns together for different patterns at the same time so you can exclude some files from particular directories and other files from everywhere.


  • No labels