Skip to content

Instantly share code, notes, and snippets.

@michaelklapper
Created August 1, 2013 09:45
Show Gist options
  • Save michaelklapper/6129961 to your computer and use it in GitHub Desktop.
Save michaelklapper/6129961 to your computer and use it in GitHub Desktop.
SVN MIME-types
[miscellany]
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store build dist target
enable-auto-props = yes
[auto-props]
*.c = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.cpp = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.h = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:executable;svn:eol-style=native;svn:keywords=Date Revision
*.cmd = svn:mime-type=text/plain;svn:eol-style=CRLF
*.bat = svn:mime-type=text/plain;svn:eol-style=CRLF
Makefile = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.obj = svn:mime-type=application/octet-stream
*.bin = svn:mime-type=application/octet-stream
*.bmp = svn:mime-type=image/bmp
*.class = svn:mime-type=application/java
*.doc = svn:mime-type=application/msword
*.exe = svn:mime-type=application/octet-stream
*.gif = svn:mime-type=image/gif
*.gz = svn:mime-type=application/x-gzip
*.jar = svn:mime-type=application/java-archive
*.jelly = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.jpg = svn:mime-type=image/jpeg
*.jpeg = svn:mime-type=image/jpeg
*.pdf = svn:mime-type=application/pdf
*.png = svn:mime-type=image/png
*.tgz = svn:mime-type=application/octet-stream
*.tif = svn:mime-type=image/tiff
*.tiff = svn:mime-type=image/tiff
*.zip = svn:mime-type=application/zip
*.txt = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.xml = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords=Date Revision
*.ent = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.dtd = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.vsl = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.xsd = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords=Date Revision
*.xsl = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords=Date Revision
*.wsdl = svn:mime-type=text/xml;svn:eol-style=native;svn:keywords=Date Revision
*.htm = svn:mime-type=text/html;svn:eol-style=native;svn:keywords=Date Revision
*.html = svn:mime-type=text/html;svn:eol-style=native;svn:keywords=Date Revision
*.css = svn:mime-type=text/css;svn:eol-style=native;svn:keywords=Date Revision
*.js = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.jsp = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.txt = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.java = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.properties = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
*.sql = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Date Revision
@michaelklapper
Copy link
Author

The correct set mime-types allow us to view the page directly from the http/svn server without checking out a working copy. They must be set up by the client, there is no way to set up the SVN-server to produce the right mime-types at output on HTTP request. Notice that mime-types schould be set not only for HTML, but also for the images and CSS files, otherwise they won't be read correctly by a browser. There is a bunch of scripts on the net allowing to automate this process for existing files.
To give the manager the ability to view the HTML pages directly from the SVN server via the browser, you have to setup the correct MIME-types for the files. You can do it by hand and create a property "svn:mime-type" or the client can set the default mime-types of known filetypes automaticaly when you add a file to the working copy.
For the automatic way, open the configuration file of you SVN client and add the folowing settings to the corresponding sections. The configuration for the TortoiseSVN is accessible through the TortoiseSVN/Settings/General window, Edit button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment