ostree/fsck: Factor out common commit checking code
ostree/fsck: Factor out common commit checking code

This will make upcoming commits a bit cleaner.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1347
Approved by: cgwalters

GNOME/ostree,GNOME/ostree,GNOME/ostree,GNOME/ostree,GNOME/ostree