Re: [viewvc-dev] Re: [viewvc-users] Don't display binary files
JJ <[email protected]> Mon, 24 Nov 2008 11:34:39 -0600
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <eed30ed90811240934m2b656a16lb9d099b5528f9fde__41436.3016527661$1227548175$gmane$org@mail.gmail.com> |
> JJ wrote: > > Please let me know if there is anything else I can do to move this patch > > forward. > > "This patch" is becoming a very fluid concept. :-) > > I need to back up a bit here -- get back to the driving goals. Please, do, > walk with me. > > As I understand it, there's a primary goal here: > > Don't show binary garbage in the Markup view. > > And a secondary goal: > > Don't show links for views which are likely to be errorful when followed > (diffs of binary files, annotations of binary files, etc.) > > [Stop me here if the goals are different, or ordered differently] I agree. > > To accomplish the first goal without expensive heuristic human-readability > calculations, and using a baseline of what ViewVC already offers today, we > decided we needed to know what MIME types were textual. That we can achieve > with exactly one new configuration option: > > text_mime_types = [list of text MIME types, with wildcard support] > > "prefer_markup" is defined today to be true for text files and web-friendly > image formats (GIF, JPEG, PNG). We needn't change that at all to meet that > first goal. But it doesn't make sense to view annotations or diffs of image > files, so the prefer_markup thing makes for an unreliable way of deciding > whether to display links to those views for image files. > > The only clean, not-configuration-complicating solution I can come up with > is to add "is_text" (alongside "prefer_markup") to the set of data > dictionary items for the files. I agree. I personally still think we should give users the following options (with different names if you prefer) in the config file. This is basically what I did in the patch, now altered to apply to is_text instead of prefer_markup. # List of mime types for text files, specified using UNIX shell wildcards. # These files will have is_text set. # If not set, all mime types will have is_text set. You can then exclude # specific types by listing them in binary_mime_types. text_mime_types = text/* # List of mime types for binary files, specified using UNIX shell wildcards. # These files will not have is_text set. # These values will override those in text_mime_types. #binary_mime_types = # If a file has no mime type, should we set is_text? no_mime_type_is_text = 0 Sure, they could modify the mime types file, but for some users it may make more sense to only list binary files instead of text files. In addition some people might be dealing with numerous files that have no extension at all. Some will want those files treated as text and others will want them treated as binary. What do you think? JJ