MCPcopy Create free account
hub / github.com/git/git / get_submodule_displaypath

Function get_submodule_displaypath

builtin/submodule--helper.c:155–171  ·  view source on GitHub ↗

the result should be freed by the caller. */

Source from the content-addressed store, hash-verified

153
154/* the result should be freed by the caller. */
155static char *get_submodule_displaypath(const char *path, const char *prefix,
156 const char *super_prefix)
157{
158 if (prefix && super_prefix) {
159 BUG("cannot have prefix '%s' and superprefix '%s'",
160 prefix, super_prefix);
161 } else if (prefix) {
162 struct strbuf sb = STRBUF_INIT;
163 char *displaypath = xstrdup(relative_path(path, prefix, &sb));
164 strbuf_release(&sb);
165 return displaypath;
166 } else if (super_prefix) {
167 return xstrfmt("%s%s", super_prefix, path);
168 } else {
169 return xstrdup(path);
170 }
171}
172
173static char *compute_rev_name(const char *sub_path, const char* object_id)
174{

Callers 8

init_submoduleFunction · 0.85
status_submoduleFunction · 0.85
sync_submoduleFunction · 0.85
deinit_submoduleFunction · 0.85
update_submodulesFunction · 0.85

Calls 4

xstrdupFunction · 0.85
relative_pathFunction · 0.85
strbuf_releaseFunction · 0.85
xstrfmtFunction · 0.85

Tested by

no test coverage detected