陈泽宇
陈泽宇

Reputation: 41

Svn treats my text file as binary

I tried add auto-props to solve the problem that it treats .xml as binary.
But still some of files even .html .js treated as bin. Show '(bin)' when imported.

How to let subversion always treat the file type as text?

Upvotes: 4

Views: 3096

Answers (3)

Atafar
Atafar

Reputation: 717

In my experience, XML files with a Windows origin often have "wide" encodings UCS-2/UTF-16 and automatically get svn:mime-type application/xml when add-ed to Subversion. You can suppress this behavior when you are adding files from the command line by specifying the --no-auto-props option:

svn add --no-auto-props <your file(s)>

You can always correct already added files with

svn pd svn:mime-type <your file(s)>

(This removes the svn:mime-type property from your file(s).) You may also want to set the svn:eol-style property so your diffs do not get messed up:

svn ps svn:eol-style native <your file(s)>

Here, instead of native you can also choose between CRLF (typically for Windows) or LF (typically Unix/Linux).

Upvotes: 5

bahrep
bahrep

Reputation: 30662

By default, Subversion attempts to determine whether a file you add to version control is binary or textual and automatically sets svn:mime-type property to application/octet-stream (for binary file) or text/plain (for textual files). Read SVNBook | File Content Type for more information about MIME and Subversion.

However, Subversion may incorrectly determine whether a file is textual or binary and will set text/plain property on some binary files or vice-verse. You can instruct Subversion client to set proper mime-type on newly added files properties based on file extension pattern automatically. See SVNBook | Automatic Property Setting.

It's important to note that automatic auto-props work for newly-added files only! All existing files in the repository won't be affected by auto-props, so you need to reconfigure those properties manually.

Upvotes: 1

Sergey Azarkevich
Sergey Azarkevich

Reputation: 2671

Check these file. Possible they has 'binary' encoding. Subversion does not recognize wide encodings like UTF-16 (UCS-2) as text (and so does not perfrom merge, diff ..).

Thy to convert such files to UTF-8

Upvotes: 0

Related Questions