Hey, On Mon, Aug 31, 2009 at 3:05 PM, Johannes Gilger<[email protected]> wrote: > > This tries to determine whether a file is binary or not, i.e. whether it > can be displayed in a sensible way. > PBGitTree is extended with the method isBinary, which first checks the > output of "git check-attr binary <file>" to see if the user set/unset > the binary attribute manually. Then it checks for common binary > file-extensions, and finally it uses Unix "file" on the first 100 bytes > of the file to make a decision. > > Signed-off-by: Johannes Gilger <[email protected]> > --- > This is the second try. I followed Pieters advice. The list of "common binary > filename-extensions" is still something up for discuission. > The binary-file detection is always overriden by gitattributes, so noone can > complain we broke any crucial functioanlity. > I thought about making a wrapper-method "isBinary" without any arguments, but > atm it seems to be overkill. The fileHeader argument can be NULL
Hmm, I think the isBinary stuff, at least partially, should be called before actually loading the contents. It's no use loading a 30MB binary file into memory if we already decided we're not able to display it :)
