You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Aleksey Nogin <al...@nogin.org> on 2005/09/29 15:03:47 UTC

[Patch] Was: Compromize proposal [Was: Forcing svn:eol-style=native on files with "binary" mime types?]

The attached patch implements items 1, 2 and 4 in the proposal below.

P.S. This is my first attempt at contributing code to subversion, so any 
pointers for the "official protocol" for getting things reviewed and 
checked in will be greatly appreciated.

On 29.09.2005 13:00, Andreas Keil wrote:

> "Aleksey Nogin" <al...@nogin.org> wrote:
> 
>>OK, I think I have an idea for a compromise that people might be more 
>>likely to find acceptable. Here is my proposal:
>>
>>1) Compile a list of "known binary" mime types (with 
>>application/octet-stream being the first in the list, obviously), 
>>replacing the current clearly imperfect "text/binary" classification with 
>>a more accurate.
>>
>>2) Leave the current behavior of "svn ps svn:eol-type" for the "known 
>>binary" mime types, but remove it from the "unknown" ones ("unknown" = 
>>those that are neither on the "known text" list nor on "known binary" 
>>one). Basically, if subversion does not know a mime type, it should just 
>>trust that the users know better.
>>
>>3) Change the auto-props behavior so that it's always possible to combine 
>>eol-type with even a "known binary" mime type via auto-props.
>>
>>4) (Optional) Add the application/xhtml+xml and application/xml types to 
>>the "known text" list.
>>
>>5) (Long-term) Allow users to override/augment the built-in lists of known 
>>text/known binary mime types via local config files.
>>
>>What do people think? If we can agree on this being a reasonable plan, I 
>>would be willing to try implementing 1-4 (although I have no experience 
>>with subversion code, so I can not guarantee quick success).
> 
> 
> All of your proposal seems reasonable to me and I would be thankful if you 
> implemented it.

-- 
Aleksey Nogin

Home Page: http://nogin.org/
E-Mail: nogin@cs.caltech.edu (office), aleksey@nogin.org (personal)
Office: Moore 04, tel: (626) 395-2200

Re: [Patch] Was: Compromize proposal [Was: Forcing svn:eol-style=native on files with "binary" mime types?]

Posted by Julian Foad <ju...@btopenworld.com>.
Aleksey Nogin wrote:
> The attached patch implements items 1, 2 and 4 in the proposal below.
> 
> P.S. This is my first attempt at contributing code to subversion, so any 
> pointers for the "official protocol" for getting things reviewed and 
> checked in will be greatly appreciated.

OK.  The first thing is that your patch should be accompanied by a log message 
that states what the patch does and why.  Read the "Log messages" section of 
the Hacking guide: <http://subversion.tigris.org/hacking.html#log-messages>, 
and any other sections that look relevant.

To help you next time, here is how I would write it for this patch:
[[[
Add a function for determining if a MIME type is known to be binary.
Add two more known text MIME types to the list.
Avoid rejecting an svn:eol-style property if binaryness is only suspected,
as in that case the user should be assumed to know better.

* subversion/include/svn_types.h
   (svn_mime_type_is_known_binary): New function.

* subversion/libsvn_subr/validate.c
   (svn_mime_type_is_binary): Add two more known text MIME types.
   (binary_mime_types): New array.
   (svn_mime_type_is_known_binary): New function.

* subversion/libsvn_wc/props.c
   (validate_eol_prop_against_file): Only reject an svn:eol-style property if
     the file has a MIME type known to be binary, not if just suspected.
]]]


> +const char * binary_mime_types [] = {

This array needs a short documentation comment.
It should also have "static" linkage as it is private.

> +  "application/octet-stream",
> +  "application/mac-binhex40",
> +  "application/mac-compactpro",
[...]
> +  "video/x-msvideo",

Can you say where you got this list from?  Is there a reliable source that we 
can use to create and update this list and the list of known text types?

> +  for (binary_type = (char **)binary_mime_types; *binary_type; binary_type++ )
> +    if ((len == strlen(*binary_type)) && (strncmp (mime_type, *binary_type, len)) == 0)
> +      return TRUE;

We might need a more efficient search algorithm, especially if the list grows, 
but this code is fine for now while we think about whether this is conceptually 
the right thing to do.

I need to think about this a bit more or hear other people's thoughts.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org