Or rather, we can do this: -----8<----- if (S_ISGITLINK(p->mod_src)) { struct strbuf sb = STRBUF_INIT; strbuf_addstr(&sb, p->sm_path); if (is_nonbare_repository_dir(&sb)) src_abbrev = verify_submodule_committish(p->sm_path, oid_to_hex(&p->oid_src)); strbuf_release(&sb); if (!src_abbrev) { missing_src = 1; /* * As `rev-parse` failed, we fallback to getting * the abbreviated hash using oid_src. We do * this as we might still need the abbreviated * hash in cases like a submodule type change, etc. */ src_abbrev = xstrndup(oid_to_hex(&p->oid_src), 7); } } else { /* * The source does not point to a submodule. * So, we fallback to getting the abbreviation using * oid_src as we might still need the abbreviated * hash in cases like submodule add, etc. */ src_abbrev = xstrndup(oid_to_hex(&p->oid_src), 7); } ----->8----- Similarly for dst as well. This solution passes all the tests and does not call 'verify_submodule_committish()' all the time. The previous approach failed a couple of tests, this one seems fine to me. How is this one?