path.c: move some code out of strbuf_git_path_submodule()