[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svnlook diff doesn't ignore binary files

From: Hari Kodungallur <hkodungallur_at_gmail.com>
Date: Fri, 18 Jul 2008 21:11:15 -0700

On Fri, Jul 18, 2008 at 8:00 PM, Dang Nguyen <haidangwa_at_comcast.net> wrote:

> Ryan Schmidt wrote:
>
>>
>> On Jul 18, 2008, at 19:11, Dang Nguyen wrote:
>>
>> I'm running Subversion 1.5.0 on Windows Server 2003. My post commit
>>> script usually sends me an email with each commit and shows me the files
>>> committed and their diffs (normal mailer stuff). I noticed a couple of
>>> times that I wasn't getting the notifications. Digging into this, I found
>>> that the "svnlook diff" portion of my script was failing, because svnlook
>>> was not ignoring the binary files being committed. Some of the files being
>>> committed are pdf's and "svnlook diff" tries to show me the changes between
>>> the previous version and the new version.
>>>
>>> We recently moved from a Linux server on 1.3.2 to the current Windows
>>> server and I never had this problem. Researching into this, I've read that
>>> svnlook uses the svn:mime-type property to determine the file type. None of
>>> these files have this property set, but they weren't set explicitly when we
>>> were on the Linux server either.
>>>
>>> Is this a regression in 1.5.0 or do I need to configure something with
>>> the new Windows server?
>>>
>>
>> There is no regression. The behavior is normal. If there is no
>> svn:mime-type property, then Subversion thinks it's a text file. When you
>> add a file, Subversion briefly analyzes the file and guesses whether it is
>> text or binary. If Subversion guesses that a file is binary, it sets
>> svn:mime-type to application/octet-stream; if it guesses a file is text, it
>> does nothing. For PDF files, Subversion often incorrectly guesses that they
>> are text (because the PDF format is rather texty) and therefore does not add
>> the svn:mime-type property. If you would like Subversion to add the
>> svn:mime-type property for PDF files, set up auto-props on your client.
>> application/pdf would be a good value to use for PDF files.
>>
>>
>>
> Since I can't ensure that all my users will set auto-props on their
> clients, it sounds like I need to modify a pre-commit hook to detect and add
> this property PDFs being checked in. Any suggestions?
>

Since it is not recommended to modify a transaction (in this case, it is
modified by adding a property to a committed file), you should just check if
a pdf file has the svn:mime-type set correctly. And if not, provide a
friendly reminder to the user to set the property and update the auto-props
accordingly.

Thanks,
-Hari
Received on 2008-07-19 06:11:47 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.