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

Function validate_and_set_submodule_gitdir

builtin/submodule--helper.c:477–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475#define INIT_CB_INIT { 0 }
476
477static int validate_and_set_submodule_gitdir(struct strbuf *gitdir_path,
478 const char *submodule_name)
479{
480 const char *value;
481 char *key;
482
483 if (validate_submodule_git_dir(gitdir_path->buf, submodule_name))
484 return -1;
485
486 key = xstrfmt("submodule.%s.gitdir", submodule_name);
487
488 /* Nothing to do if the config already exists. */
489 if (!repo_config_get_string_tmp(the_repository, key, &value)) {
490 free(key);
491 return 0;
492 }
493
494 if (repo_config_set_gently(the_repository, key, gitdir_path->buf)) {
495 free(key);
496 return -1;
497 }
498
499 free(key);
500 return 0;
501}
502
503static void create_default_gitdir_config(const char *submodule_name)
504{

Callers 1

Calls 4

xstrfmtFunction · 0.85
repo_config_set_gentlyFunction · 0.85

Tested by

no test coverage detected