Lines Matching refs:repo

42 static void repo_set_commondir(struct repository *repo,  in repo_set_commondir()  argument
47 free(repo->commondir); in repo_set_commondir()
50 repo->different_commondir = 1; in repo_set_commondir()
51 repo->commondir = xstrdup(commondir); in repo_set_commondir()
55 repo->different_commondir = get_common_dir_noenv(&sb, repo->gitdir); in repo_set_commondir()
56 repo->commondir = strbuf_detach(&sb, NULL); in repo_set_commondir()
59 void repo_set_gitdir(struct repository *repo, in repo_set_gitdir() argument
69 char *old_gitdir = repo->gitdir; in repo_set_gitdir()
71 repo->gitdir = xstrdup(gitfile ? gitfile : root); in repo_set_gitdir()
74 repo_set_commondir(repo, o->commondir); in repo_set_gitdir()
76 if (!repo->objects->odb) { in repo_set_gitdir()
77 CALLOC_ARRAY(repo->objects->odb, 1); in repo_set_gitdir()
78 repo->objects->odb_tail = &repo->objects->odb->next; in repo_set_gitdir()
80 expand_base_dir(&repo->objects->odb->path, o->object_dir, in repo_set_gitdir()
81 repo->commondir, "objects"); in repo_set_gitdir()
83 free(repo->objects->alternate_db); in repo_set_gitdir()
84 repo->objects->alternate_db = xstrdup_or_null(o->alternate_db); in repo_set_gitdir()
85 expand_base_dir(&repo->graft_file, o->graft_file, in repo_set_gitdir()
86 repo->commondir, "info/grafts"); in repo_set_gitdir()
87 expand_base_dir(&repo->index_file, o->index_file, in repo_set_gitdir()
88 repo->gitdir, "index"); in repo_set_gitdir()
91 void repo_set_hash_algo(struct repository *repo, int hash_algo) in repo_set_hash_algo() argument
93 repo->hash_algo = &hash_algos[hash_algo]; in repo_set_hash_algo()
100 static int repo_init_gitdir(struct repository *repo, const char *gitdir) in repo_init_gitdir() argument
121 repo_set_gitdir(repo, resolved_gitdir, &args); in repo_init_gitdir()
128 void repo_set_worktree(struct repository *repo, const char *path) in repo_set_worktree() argument
130 repo->worktree = real_pathdup(path, 1); in repo_set_worktree()
132 trace2_def_repo(repo); in repo_set_worktree()
158 int repo_init(struct repository *repo, in repo_init() argument
163 memset(repo, 0, sizeof(*repo)); in repo_init()
165 repo->objects = raw_object_store_new(); in repo_init()
166 repo->parsed_objects = parsed_object_pool_new(); in repo_init()
168 if (repo_init_gitdir(repo, gitdir)) in repo_init()
171 if (read_and_verify_repository_format(&format, repo->commondir)) in repo_init()
174 repo_set_hash_algo(repo, format.hash_algo); in repo_init()
177 repo->repository_format_partial_clone = format.partial_clone; in repo_init()
181 repo_set_worktree(repo, worktree); in repo_init()
187 repo_clear(repo); in repo_init()
238 void repo_clear(struct repository *repo) in repo_clear() argument
240 FREE_AND_NULL(repo->gitdir); in repo_clear()
241 FREE_AND_NULL(repo->commondir); in repo_clear()
242 FREE_AND_NULL(repo->graft_file); in repo_clear()
243 FREE_AND_NULL(repo->index_file); in repo_clear()
244 FREE_AND_NULL(repo->worktree); in repo_clear()
245 FREE_AND_NULL(repo->submodule_prefix); in repo_clear()
247 raw_object_store_clear(repo->objects); in repo_clear()
248 FREE_AND_NULL(repo->objects); in repo_clear()
250 parsed_object_pool_clear(repo->parsed_objects); in repo_clear()
251 FREE_AND_NULL(repo->parsed_objects); in repo_clear()
253 if (repo->config) { in repo_clear()
254 git_configset_clear(repo->config); in repo_clear()
255 FREE_AND_NULL(repo->config); in repo_clear()
258 if (repo->submodule_cache) { in repo_clear()
259 submodule_cache_free(repo->submodule_cache); in repo_clear()
260 repo->submodule_cache = NULL; in repo_clear()
263 if (repo->index) { in repo_clear()
264 discard_index(repo->index); in repo_clear()
265 if (repo->index != &the_index) in repo_clear()
266 FREE_AND_NULL(repo->index); in repo_clear()
269 if (repo->promisor_remote_config) { in repo_clear()
270 promisor_remote_clear(repo->promisor_remote_config); in repo_clear()
271 FREE_AND_NULL(repo->promisor_remote_config); in repo_clear()
275 int repo_read_index(struct repository *repo) in repo_read_index() argument
279 if (!repo->index) in repo_read_index()
280 CALLOC_ARRAY(repo->index, 1); in repo_read_index()
283 if (!repo->index->repo) in repo_read_index()
284 repo->index->repo = repo; in repo_read_index()
285 else if (repo->index->repo != repo) in repo_read_index()
288 res = read_index_from(repo->index, repo->index_file, repo->gitdir); in repo_read_index()
290 prepare_repo_settings(repo); in repo_read_index()
291 if (repo->settings.command_requires_full_index) in repo_read_index()
292 ensure_full_index(repo->index); in repo_read_index()
297 int repo_hold_locked_index(struct repository *repo, in repo_hold_locked_index() argument
301 if (!repo->index_file) in repo_hold_locked_index()
303 return hold_lock_file_for_update(lf, repo->index_file, flags); in repo_hold_locked_index()