How does the svn mirror treat svn:ignore property?

Can you please let us know how the svn mirror treats the property svn:global-ignores ? Does it migrate this property and its content to .gitignore?

No, it doesn’t take it into account. The reason was that when we added svn:ignores <-> .gitignore support, svn:global-ignores didn’t exist and when they appeared it was too complicated to mix that behaviour with svn:ignore and .gitignore. So we don’t handle svn:global-ignores at all.

Hi,

So, how about other property sets of svn:ignores ? Is there any documentatation that we can refer what all is supported for this property?

Thanks

Hello,
I’ve found out we don’t have well-written documentation on this topic. In general, ignores processing is controlled by translate.ignores option. It is enabled by default, one can disable it on the fly by edting subgit/config and running ‘subgit install’ to apply changes but one cannot enable it back once it is disabled.

The idea of this property to maintain the set of ignored path in Git and SVN equal, when possible. For example, if one adds .gitignore of the following content to Git repository root:

/ignoredFile
/*.o
/ignoredDirectory/ignoredFile
/*/ignoredPattern
/ignoredDirectoryOnly/

the following svn:ignore properties will be set on the branch root or trunk:

 ignoredFile
 *.o
 ignoredPattern
 ignoredDirectoryOnly

Moreover, an empty ‘ignoredDirectory’ will be created and it will have svn:ignore

ignoredFile
ignoredPattern

Also ‘/*/ignoredPattern’ will be applied to every directory inside the branch root or trunk resulting into svn:ignore=ignoredPattern on them (if there’re any). If you add some directory to the Git tree root later, when pushing this .gitgnore pattern will automatically apply to them and they will get svn:ignore=ignoredPattern on them after translation to SVN. In some sense this mimicks behaviour of global ignores.

I hope this makes sense to you. Node that in Git ‘/ignoredDirectoryOnly/’
pattern ignores only directories with such name but not files (because it ends with slash ‘/’) while in SVN there’s no way to ignore only directories but not files. So SubGit treats /ignoredDirectoryOnly/’ in the same way as ‘/ignoredDirectoryOnly’, i.e. in SVN all directories and files are ignored (this is not perfect but the best one can do).

In Git there’s a notion of recursive patterns. The patterns are recursive if they contain no slash ‘/’ except maybe at the end of the pattern. E.g. the following patterns are recursive:

*
*.o
file
directory/

The following Git patterns are not recursive:

/*
/*.o
/file
/directory/
/directory/file
directory/file
/directory/
directory/subdirectory/file

Non-recursive patterns are translated by setting svn:ignore on corresponding directories.

Recursive patterns are applied recursively to every relevant directory setting svn:ignore on all of them to have the same set of ignored paths in SVN and Git. For example, when Git pattern *.o is applied recursively, it adds *.o line to every svn:ignore value on all the directories inside the corresponding SVN branch or trunk. Sometimes this means that small change in .gitignore may result in massive change in SVN, so be careful about recursive patterns! I recommend to use non-recursive patterns wherever possible. See .gitignore format documentation on recursive and non-recursive patterns.

The corresponding lines in .gitignore and in svn:ignore properties are kept in sync and changes to them are synchronized in the most meaningful way. It’s really difficult to enumerate all possible changes and the way SubGit handles them. Editing of some svn:ignore lines result into editing of corresponding .gitignore lines, removing of some svn:ignore lines result into removing of corresponding .gitignore lines (unless the patterns are recursive, in this case removals result into .gitignore lines that are exceptions to general recursive rules).

If you have questions about some certain scenario, don’t hesitate to ask or just try it on some test SubGit setup:

svnadmin create svn.repo
subgit configure --svn-url file:///path/to/svn.repo git.repo
subgit install git.repo
git clone git.repo wt/
cd wt/
#edit .gitignore to add patterns you're not sure about
git add .gitgnore
git commit -m "Test ignores translation."
git push origin master
#see how it is processed in SVN:
svn proplist -v --depth infinity file:///path/to/svn.repo