| 166 | } |
| 167 | |
| 168 | void repo_set_gitdir(struct repository *repo, |
| 169 | const char *root, |
| 170 | const struct set_gitdir_args *o) |
| 171 | { |
| 172 | const char *gitfile = read_gitfile(root); |
| 173 | /* |
| 174 | * repo->gitdir is saved because the caller could pass "root" |
| 175 | * that also points to repo->gitdir. We want to keep it alive |
| 176 | * until after xstrdup(root). Then we can free it. |
| 177 | */ |
| 178 | char *old_gitdir = repo->gitdir; |
| 179 | |
| 180 | repo->gitdir = xstrdup(gitfile ? gitfile : root); |
| 181 | free(old_gitdir); |
| 182 | |
| 183 | repo_set_commondir(repo, o->commondir); |
| 184 | repo->disable_ref_updates = o->disable_ref_updates; |
| 185 | |
| 186 | expand_base_dir(&repo->graft_file, o->graft_file, |
| 187 | repo->commondir, "info/grafts"); |
| 188 | expand_base_dir(&repo->index_file, o->index_file, |
| 189 | repo->gitdir, "index"); |
| 190 | } |
| 191 | |
| 192 | void repo_set_hash_algo(struct repository *repo, uint32_t hash_algo) |
| 193 | { |
no test coverage detected