code: Fix an exception of root commit.

When you try to see the changes from the root commit, an exception
occurs because it has no parent commit so cannot get the difference
between the commit and its parent.