Do not let the user export to a head without the head being strict
subset of what we are exporting. (In that case, the user should
import the new stuff from git first.)
Move some common GIT interfacing routines and utility functions from
git_*.cc to git.*, possibly renaming them when necessary to keep
them namespace-clean.