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

Re: Inconsistency between diff and svn diff

From: Stefan Sperling <stsp_at_elego.de>
Date: Tue, 29 Sep 2009 11:58:22 +0100

On Tue, Sep 29, 2009 at 10:18:36AM +0100, Giulio Troccoli wrote:
> I came across this problem while using ViewVC, but I don't think it's a problem with ViewVC, and it mihgt not even be a problem with Subversion. It's just that I have different results using diff and svn diff and I don't understand why.
>
> I have a text file, with the svn:mime-type property set to text/plain, which unfortutanely does not have a newline at the end (and maybe this is the problem).
>
> Running the svn diff command
>
> svn diff -c5867 http://<path>/zdiacb10.rwt
>
> gives me the differences but ends with the message
>
> \ No newline at end of file
>
> (yes, with a heading \)
>
> I have also use the svn cat command twice to get the file at revision 5866 and 5867 and the used the diff command like this
>
> svn cat -r5866 http://<path>/zdiacb10.rwt > gt1
> svn cat -r5867 http://<path>/zdiacb10.rwt > gt2
> diff gt1 gt2
>
> But the result was
>
> Binary files gt1 and gt2 differ
>
> Is it because of the missing newline at the end that diff thinks these are binay files? And is it because the svn:mime-type property is set that svn is able to actually give the differences?

Sounds like there are characters in those files which aren't considered
printable (e.g. by isprint()) in your currently configured locale.
So diff thinks the file is binary, but you told svn to treat it as
text/plain anyways so it works there.

Try passing the -a flag to diff:

     -a Treat all files as ASCII text. Normally diff will simply print
             ``Binary files ... differ'' if files contain binary characters.
             Use of this option forces diff to produce a diff.

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2401575

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-09-29 12:59:15 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.