Test repository for Git wrappers
Does your Git wrapper support commit messages encoded in latin-1? (
encoding header) In Shift-JIS? Actually, any encoding you can think of, given that Git doesn't care.
Do you know about multiline headers? Like in signed commits? (
What about merge tags (
mergetag), then? (another multiline header)
Did you know that a commit could have multiple
mergetag headers? (If you happen to merge multiple signed tags at once)
Oh, and of course, one can sign one of those multiple signed tags merge commit! And write the message for that commit in any encoding they like!
Because I want to write the best possible Git wrapper, I've started to collect all the weird commits (and other objects) I could find in a special repository: https://github.com/book/git-test-repository/.
Actually, rather than manually adding commits to that weird repository, I made a tool to write them for me, write the description, and package them all in a nice bundle I can simply ship with my tests. And because my tests need some way to get to the data I want to parse, I also wrote a tool to produce some Perl out of that bundle. The tools are available at https://github.com/book/git-test-repo-tool/.
Ironically, Git::Repository is such a thin wrapper around Git that I don't need that test repository to torture-test it. Git::Repository::Plugin::Log, on the other hand, tries to parse the output of
git log, and that's when having a few edge-cases is handy for testing. Check out the its test suite for a nice example of using that test bundle.
If you're using a Git wrapper (other than
qx, that is), you might consider using Git::Repository, which has allegedly been tested against all those weird commits.
If you're writing a Git wrapper, you're welcome to use that bundle for your tests. And if you find some weirder objects, please know that I welcome them in my collection.