On Sun, Aug 30, 2009 at 11:12 PM, Johannes Gilger<[email protected]> wrote: > > This uses the tool "file" to determine whether a file in a PBGitTree is > binary or not, i.e. whether it can be displayed in a sensible way. It > only takes the first 100 characters to make that decision, since it has > to invoke "file" using the file-content as an input-pipe. For binary > files a placeholder is returned. This does _not_ affect QuickLook. > > Comments would be appreciated!
Hmm, this seems like a good addition, and the code looks good. Here are some suggestions: * git-gui uses 'git check-attr binary <path>' or something similar to see if there's a .gitattributes that states the file is binary. I think that's a good first step we should take too. * We could blacklist some common extensions, like .pdf, .jpeg, .png etc, to catch 90% of the files * I think the check should be in a separate method, rather than in -[PBGitTree contents]. That method should be invoked before displaying the contents. Not sure how to do that with bindings though, perhaps by going through the controller? * Somewhere in the future, we might want to replace the TextView with something else, so we can also display images? Not sure how to do that, perhaps replace the view within the ScrollView depending on what we want to display, or have both an image view and textview in the scrollview, and just hide one of them at a time.
