submodule: add a helper to check if it is safe to write to .gitmodules