Stash support

Stash support for files and commits, including some refactoring for the generate_file_link to allow individual testing.