MCPcopy Index your code
hub / github.com/git/git / getdir

Function getdir

http-backend.c:703–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701}
702
703static char* getdir(void)
704{
705 struct strbuf buf = STRBUF_INIT;
706 char *pathinfo = getenv("PATH_INFO");
707 char *root = getenv("GIT_PROJECT_ROOT");
708 char *path = getenv("PATH_TRANSLATED");
709
710 if (root && *root) {
711 if (!pathinfo || !*pathinfo)
712 die("GIT_PROJECT_ROOT is set but PATH_INFO is not");
713 if (daemon_avoid_alias(pathinfo))
714 die("'%s': aliased", pathinfo);
715 end_url_with_slash(&buf, root);
716 if (pathinfo[0] == '/')
717 pathinfo++;
718 strbuf_addstr(&buf, pathinfo);
719 return strbuf_detach(&buf, NULL);
720 } else if (path && *path) {
721 return xstrdup(path);
722 } else
723 die("No GIT_PROJECT_ROOT or PATH_TRANSLATED from server");
724 return NULL;
725}
726
727static struct service_cmd {
728 const char *method;

Callers 1

cmd_mainFunction · 0.85

Calls 6

daemon_avoid_aliasFunction · 0.85
end_url_with_slashFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_detachFunction · 0.85
xstrdupFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected