submodule.c: factor out early loop termination in is_submodule_modified