importpkg: refactor commit handling out of process_package*