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

Function initialize_repository

repository.c:65–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void initialize_repository(struct repository *repo)
66{
67 if (repo->initialized)
68 BUG("repository initialized already");
69 repo->initialized = true;
70
71 repo->remote_state = remote_state_new();
72 repo->parsed_objects = parsed_object_pool_new(repo);
73 ALLOC_ARRAY(repo->index, 1);
74 index_state_init(repo->index, repo);
75 repo->check_deprecated_config = true;
76 repo_config_values_init(&repo->config_values_private_);
77
78 /*
79 * When a command runs inside a repository, it learns what
80 * hash algorithm is in use from the repository, but some
81 * commands are designed to work outside a repository, yet
82 * they want to access the_hash_algo, if only for the length
83 * of the hashed value to see if their input looks like a
84 * plausible hash value.
85 *
86 * We are in the process of identifying such code paths and
87 * giving them an appropriate default individually; any
88 * unconverted code paths that try to access the_hash_algo
89 * will thus fail. The end-users however have an escape hatch
90 * to set GIT_TEST_DEFAULT_HASH_ALGO environment variable to
91 * "sha1" to get back the old behaviour of defaulting to SHA-1.
92 *
93 * This escape hatch is deliberately kept unadvertised, so
94 * that they see crashes and we can get a report before
95 * telling them about it.
96 */
97 if (repo == the_repository)
98 set_default_hash_algo(repo);
99}
100
101static void expand_base_dir(char **out, const char *in,
102 const char *base_dir, const char *def_in)

Callers 3

repo_initFunction · 0.85
init_gitFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85

Calls 5

remote_state_newFunction · 0.85
parsed_object_pool_newFunction · 0.85
index_state_initFunction · 0.85
repo_config_values_initFunction · 0.85
set_default_hash_algoFunction · 0.85

Tested by

no test coverage detected