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

Function handle_remote_ls_ctx

http-push.c:1070–1121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1068}
1069
1070static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
1071{
1072 struct remote_ls_ctx *ls = (struct remote_ls_ctx *)ctx->userData;
1073
1074 if (tag_closed) {
1075 if (!strcmp(ctx->name, DAV_PROPFIND_RESP) && ls->dentry_name) {
1076 if (ls->dentry_flags & IS_DIR) {
1077
1078 /* ensure collection names end with slash */
1079 str_end_url_with_slash(ls->dentry_name, &ls->dentry_name);
1080
1081 if (ls->flags & PROCESS_DIRS) {
1082 ls->userFunc(ls);
1083 }
1084 if (strcmp(ls->dentry_name, ls->path) &&
1085 ls->flags & RECURSIVE) {
1086 remote_ls(ls->dentry_name,
1087 ls->flags,
1088 ls->userFunc,
1089 ls->userData);
1090 }
1091 } else if (ls->flags & PROCESS_FILES) {
1092 ls->userFunc(ls);
1093 }
1094 } else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {
1095 char *path = ctx->cdata;
1096 if (*ctx->cdata == 'h') {
1097 path = strstr(path, "//");
1098 if (path) {
1099 path = strchr(path+2, '/');
1100 }
1101 }
1102 if (path) {
1103 const char *url = repo->url;
1104 if (repo->path)
1105 url = repo->path;
1106 if (strncmp(path, url, repo->path_len))
1107 error("Parsed path '%s' does not match url: '%s'",
1108 path, url);
1109 else {
1110 path += repo->path_len;
1111 ls->dentry_name = xstrdup(path);
1112 }
1113 }
1114 } else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
1115 ls->dentry_flags |= IS_DIR;
1116 }
1117 } else if (!strcmp(ctx->name, DAV_PROPFIND_RESP)) {
1118 FREE_AND_NULL(ls->dentry_name);
1119 ls->dentry_flags = 0;
1120 }
1121}
1122
1123/*
1124 * NEEDSWORK: remote_ls() ignores info/refs on the remote side. But it

Callers

nothing calls this directly

Calls 4

str_end_url_with_slashFunction · 0.85
remote_lsFunction · 0.85
errorFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected