git-read

Add support for re-writing a project’s history

If you’re consuming this tool and using it to tell the story of your project’s origins and growth, you might be tempted to become a bit of a revisionist historian.

This might come as a shock, but this project was not perfected implemented from the start, and is in fact the result of countless pick, squash, reword, fixup, and drop rebase operations.

While this can be harmless for pre-released projects, rewriting history once the resulting website is deployed and publicized would result in 404s and broken URLs.

To counteract this, git-read will include and compile pages for any commits that are git tag-ed, along with the rest of their history.

To denote that a commit is “out of date”, and is no longer available on the main branch, calls to Middleman’s proxy have been updated to pass in the out_of_date local Boolean to denote whether or not a page is built from a tagged commit. When rendering from the main branch or the project’s README.md, out_of_date is declared as false.

In the case where the main branch and the tagged commit share ancestors, the main branch’s version will be rendered second, and won’t display the “stale” banner.

Test coverage

To ensure that the new feature is covered by tests, this commit extends the new GitHelpers module to enable tests to switch git branches (via #switch_branch), and to add tagged commits (via #add_tag).