LGTM with nits. +static char *get_submodule_displaypath(const char *path, const char *prefix)
this could do with a comment
/* the result should be freed by the caller. */
+ } else if (super_prefix) {
+ int len = strlen(super_prefix);
+ const char *format = is_dir_sep(super_prefix[len - 1]) ? "%s%s"
: "%s/%s";
what if len == 0? The handling of '/' looks like a change from the original.

