* Create, record, and return a ref_store instance for the specified * gitdir using the given ref storage format. */
| 2319 | * gitdir using the given ref storage format. |
| 2320 | */ |
| 2321 | static struct ref_store *ref_store_init(struct repository *repo, |
| 2322 | enum ref_storage_format format, |
| 2323 | const char *gitdir, |
| 2324 | unsigned int flags) |
| 2325 | { |
| 2326 | const struct ref_storage_be *be; |
| 2327 | struct ref_store *refs; |
| 2328 | struct ref_store_init_options opts = { |
| 2329 | .access_flags = flags, |
| 2330 | .log_all_ref_updates = repo_settings_get_log_all_ref_updates(repo), |
| 2331 | }; |
| 2332 | |
| 2333 | be = find_ref_storage_backend(format); |
| 2334 | if (!be) |
| 2335 | BUG("reference backend is unknown"); |
| 2336 | |
| 2337 | /* |
| 2338 | * TODO Send in a 'struct worktree' instead of a 'gitdir', and |
| 2339 | * allow the backend to handle how it wants to deal with worktrees. |
| 2340 | */ |
| 2341 | refs = be->init(repo, repo->ref_storage_payload, gitdir, &opts); |
| 2342 | |
| 2343 | return refs; |
| 2344 | } |
| 2345 | |
| 2346 | void ref_store_release(struct ref_store *ref_store) |
| 2347 | { |
no test coverage detected