For background on my question: svn won't diff a file it thinks is binary
$ svn diff data/assets/site/ir_gallery/images.kml
Index: data/assets/site/ir_gallery/images.kml
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/vnd.google-earth.kml+xml
A recent stack overflow answer ( svn diff: file marked as binary type ) showed you can force a mime type:
$ svn propset svn:mime-type 'text/plain' data/assets/site/ir_gallery/images.kml
property 'svn:mime-type' set on 'data/assets/site/ir_gallery/images.kml'
Note that prior answer is incomplete... you also have to:
$ svn commit
Now my new question is: can I set a default, so all future "vnd.google-earth.kml+xml" files are treated as text by svn? The redbook appears silent on this topic: http://svnbook.red-bean.com/en/1.2/svn.advanced.props.html saying only:
...if a file's svn:mime-type property is set to a non-text MIME type
(generally, something that doesn't begin with text/, though there are
exceptions) then...
What exceptions? Are these exceptions baked into the svn code, or accessible?
The answer depends on the svn client that you are using. In the official svn client, the option you are looking for is Automatic Property Setting. The tl;dr version is you need to update your user or system config, set the enable-auto-props
setting to yes
in the miscellany
section, and create a new section called auto-props
which defines the patterns you want to match and the properties you are looking to set.
For your example of kml files:
### Section for configuring miscelleneous Subversion options.
[miscellany]
enable-auto-props = yes
[auto-props]
*.kml = svn:mime-type=text/plain;svn:eol-style=native
This will ensure that when you add a .kml file to your repository, it will have a mime-type of text/plain and will use line endings native to the platform of the client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With