gollum/gollum-lib — pull request #27 by cpence (2013-06-17 15:57:38+00:00)
Title: Add support for references to files on disk

These two commits add full support for the Gollum::File class to return references to files that actually exist on the disk.

Let me say something about the use-case here. I've got a large Gollum wiki, which includes a bunch of huge files on the disk using [git-annex.](http://git-annex.branchable.com/) (That was why I pushed a few commits a while back enabling symbolic link support.)

There's still a massive potential for speed-up here, though. As it stands now, even if a file is present on the disk, the repository is checked out to HEAD, and the user's requesting the HEAD version of the file, Gollum will read the *entire file* into memory, then buffer it back out to the client.

These commits add support for a special "on-disk file reference" to Gollum::File. The intent is that then, in the [relevant code for sending files out to the browser,](https://github.com/gollum/gollum/blob/master/lib/gollum/app.rb#L406) we'll pass `try_on_disk = true`, and, if the file really is present on the disk, use the proper Sinatra method for streaming a large file to the client's browser. (I'll happily write that pull request too, if you guys like what I've done in this one.)

This *should* be transparent to any users of Gollum::File. If you don't set `try_on_disk` to true, you don't enable any of this new code. If you do set `try_on_disk` to true, and the file's not available, it falls back to the original code. And all the tests pass, including the interaction of symlinks and on_disk file support.