+/*
+ * Return a pointer to a cached_refs for the specified submodule. For
+ * the main repository, use submodule==NULL. The returned structure
+ * will be allocated and initialized but not necessarily populated; it
+ * should not be freed.
+ */
+static struct cached_refs *get_cached_refs(const char *submodule)
+{
+ if (!submodule)
+ return &cached_refs;
+ else {
+ /* For now, don't reuse the refs cache for submodules. */
+ clear_cached_refs(&submodule_refs);
+ return &submodule_refs;
+ }
+}
+