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

Function validate_submodule_path

submodule.c:2455–2480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2453}
2454
2455int validate_submodule_path(const char *path)
2456{
2457 char *p = xstrdup(path);
2458 struct stat st;
2459 int i, ret = 0;
2460 char sep;
2461
2462 for (i = 0; !ret && p[i]; i++) {
2463 if (!is_dir_sep(p[i]))
2464 continue;
2465
2466 sep = p[i];
2467 p[i] = '\0';
2468 /* allow missing components, but no symlinks */
2469 ret = lstat(p, &st) || !S_ISLNK(st.st_mode) ? 0 : -1;
2470 p[i] = sep;
2471 if (ret)
2472 error(_("expected '%.*s' in submodule path '%s' not to "
2473 "be a symbolic link"), i, p, p);
2474 }
2475 if (!lstat(p, &st) && S_ISLNK(st.st_mode))
2476 ret = error(_("expected submodule path '%s' not to be a "
2477 "symbolic link"), p);
2478 free(p);
2479 return ret;
2480}
2481
2482
2483/*

Callers 15

submodule_has_commitsFunction · 0.85
push_submoduleFunction · 0.85
submodule_push_checkFunction · 0.85
fetch_task_createFunction · 0.85
is_submodule_modifiedFunction · 0.85
submodule_uses_gitfileFunction · 0.85
bad_to_remove_submoduleFunction · 0.85
submodule_reset_indexFunction · 0.85

Calls 2

xstrdupFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected