Lines Matching refs:repo

40 static void repo_set_commondir(struct repository *repo,  in repo_set_commondir()  argument
45 free(repo->commondir); in repo_set_commondir()
48 repo->different_commondir = 1; in repo_set_commondir()
49 repo->commondir = xstrdup(commondir); in repo_set_commondir()
53 repo->different_commondir = get_common_dir_noenv(&sb, repo->gitdir); in repo_set_commondir()
54 repo->commondir = strbuf_detach(&sb, NULL); in repo_set_commondir()
57 void repo_set_gitdir(struct repository *repo, in repo_set_gitdir() argument
67 char *old_gitdir = repo->gitdir; in repo_set_gitdir()
69 repo->gitdir = xstrdup(gitfile ? gitfile : root); in repo_set_gitdir()
72 repo_set_commondir(repo, o->commondir); in repo_set_gitdir()
74 if (!repo->objects->odb) { in repo_set_gitdir()
75 repo->objects->odb = xcalloc(1, sizeof(*repo->objects->odb)); in repo_set_gitdir()
76 repo->objects->odb_tail = &repo->objects->odb->next; in repo_set_gitdir()
78 expand_base_dir(&repo->objects->odb->path, o->object_dir, in repo_set_gitdir()
79 repo->commondir, "objects"); in repo_set_gitdir()
81 free(repo->objects->alternate_db); in repo_set_gitdir()
82 repo->objects->alternate_db = xstrdup_or_null(o->alternate_db); in repo_set_gitdir()
83 expand_base_dir(&repo->graft_file, o->graft_file, in repo_set_gitdir()
84 repo->commondir, "info/grafts"); in repo_set_gitdir()
85 expand_base_dir(&repo->index_file, o->index_file, in repo_set_gitdir()
86 repo->gitdir, "index"); in repo_set_gitdir()
89 void repo_set_hash_algo(struct repository *repo, int hash_algo) in repo_set_hash_algo() argument
91 repo->hash_algo = &hash_algos[hash_algo]; in repo_set_hash_algo()
98 static int repo_init_gitdir(struct repository *repo, const char *gitdir) in repo_init_gitdir() argument
119 repo_set_gitdir(repo, resolved_gitdir, &args); in repo_init_gitdir()
126 void repo_set_worktree(struct repository *repo, const char *path) in repo_set_worktree() argument
128 repo->worktree = real_pathdup(path, 1); in repo_set_worktree()
130 trace2_def_repo(repo); in repo_set_worktree()
156 int repo_init(struct repository *repo, in repo_init() argument
161 memset(repo, 0, sizeof(*repo)); in repo_init()
163 repo->objects = raw_object_store_new(); in repo_init()
164 repo->parsed_objects = parsed_object_pool_new(); in repo_init()
166 if (repo_init_gitdir(repo, gitdir)) in repo_init()
169 if (read_and_verify_repository_format(&format, repo->commondir)) in repo_init()
172 repo_set_hash_algo(repo, format.hash_algo); in repo_init()
175 repo_set_worktree(repo, worktree); in repo_init()
181 repo_clear(repo); in repo_init()
230 void repo_clear(struct repository *repo) in repo_clear() argument
232 FREE_AND_NULL(repo->gitdir); in repo_clear()
233 FREE_AND_NULL(repo->commondir); in repo_clear()
234 FREE_AND_NULL(repo->graft_file); in repo_clear()
235 FREE_AND_NULL(repo->index_file); in repo_clear()
236 FREE_AND_NULL(repo->worktree); in repo_clear()
237 FREE_AND_NULL(repo->submodule_prefix); in repo_clear()
239 raw_object_store_clear(repo->objects); in repo_clear()
240 FREE_AND_NULL(repo->objects); in repo_clear()
242 parsed_object_pool_clear(repo->parsed_objects); in repo_clear()
243 FREE_AND_NULL(repo->parsed_objects); in repo_clear()
245 if (repo->config) { in repo_clear()
246 git_configset_clear(repo->config); in repo_clear()
247 FREE_AND_NULL(repo->config); in repo_clear()
250 if (repo->submodule_cache) { in repo_clear()
251 submodule_cache_free(repo->submodule_cache); in repo_clear()
252 repo->submodule_cache = NULL; in repo_clear()
255 if (repo->index) { in repo_clear()
256 discard_index(repo->index); in repo_clear()
257 if (repo->index != &the_index) in repo_clear()
258 FREE_AND_NULL(repo->index); in repo_clear()
262 int repo_read_index(struct repository *repo) in repo_read_index() argument
264 if (!repo->index) in repo_read_index()
265 repo->index = xcalloc(1, sizeof(*repo->index)); in repo_read_index()
267 return read_index_from(repo->index, repo->index_file, repo->gitdir); in repo_read_index()
270 int repo_hold_locked_index(struct repository *repo, in repo_hold_locked_index() argument
274 if (!repo->index_file) in repo_hold_locked_index()
276 return hold_lock_file_for_update(lf, repo->index_file, flags); in repo_hold_locked_index()