|
2 | 2 | * The backend-independent part of the reference module. |
3 | 3 | */ |
4 | 4 |
|
5 | | -#define USE_THE_REPOSITORY_VARIABLE |
6 | | - |
7 | 5 | #include "git-compat-util.h" |
8 | 6 | #include "abspath.h" |
9 | 7 | #include "advice.h" |
@@ -744,25 +742,26 @@ static char *substitute_branch_name(struct repository *r, |
744 | 742 | return NULL; |
745 | 743 | } |
746 | 744 |
|
747 | | -void copy_branchname(struct strbuf *sb, const char *name, |
| 745 | +void copy_branchname(struct repository *repo, |
| 746 | + struct strbuf *sb, const char *name, |
748 | 747 | enum interpret_branch_kind allowed) |
749 | 748 | { |
750 | 749 | int len = strlen(name); |
751 | 750 | struct interpret_branch_name_options options = { |
752 | 751 | .allowed = allowed |
753 | 752 | }; |
754 | | - int used = repo_interpret_branch_name(the_repository, name, len, sb, |
| 753 | + int used = repo_interpret_branch_name(repo, name, len, sb, |
755 | 754 | &options); |
756 | 755 |
|
757 | 756 | if (used < 0) |
758 | 757 | used = 0; |
759 | 758 | strbuf_add(sb, name + used, len - used); |
760 | 759 | } |
761 | 760 |
|
762 | | -int check_branch_ref(struct strbuf *sb, const char *name) |
| 761 | +int check_branch_ref(struct repository *repo, struct strbuf *sb, const char *name) |
763 | 762 | { |
764 | 763 | if (startup_info->have_repository) |
765 | | - copy_branchname(sb, name, INTERPRET_BRANCH_LOCAL); |
| 764 | + copy_branchname(repo, sb, name, INTERPRET_BRANCH_LOCAL); |
766 | 765 | else |
767 | 766 | strbuf_addstr(sb, name); |
768 | 767 |
|
@@ -3326,9 +3325,9 @@ static int move_files(const char *from_path, const char *to_path, struct strbuf |
3326 | 3325 | return ret; |
3327 | 3326 | } |
3328 | 3327 |
|
3329 | | -static int has_worktrees(void) |
| 3328 | +static int has_worktrees(struct repository *repo) |
3330 | 3329 | { |
3331 | | - struct worktree **worktrees = get_worktrees(the_repository); |
| 3330 | + struct worktree **worktrees = get_worktrees(repo); |
3332 | 3331 | int ret = 0; |
3333 | 3332 | size_t i; |
3334 | 3333 |
|
@@ -3373,12 +3372,8 @@ int repo_migrate_ref_storage_format(struct repository *repo, |
3373 | 3372 | * Worktrees complicate the migration because every worktree has a |
3374 | 3373 | * separate ref storage. While it should be feasible to implement, this |
3375 | 3374 | * is pushed out to a future iteration. |
3376 | | - * |
3377 | | - * TODO: we should really be passing the caller-provided repository to |
3378 | | - * `has_worktrees()`, but our worktree subsystem doesn't yet support |
3379 | | - * that. |
3380 | 3375 | */ |
3381 | | - if (has_worktrees()) { |
| 3376 | + if (has_worktrees(repo)) { |
3382 | 3377 | strbuf_addstr(errbuf, "migrating repositories with worktrees is not supported yet"); |
3383 | 3378 | ret = -1; |
3384 | 3379 | goto done; |
@@ -3503,7 +3498,7 @@ int repo_migrate_ref_storage_format(struct repository *repo, |
3503 | 3498 | * repository format so that clients will use the new ref store. |
3504 | 3499 | * We also need to swap out the repository's main ref store. |
3505 | 3500 | */ |
3506 | | - initialize_repository_version(the_repository, hash_algo_by_ptr(repo->hash_algo), format, 1); |
| 3501 | + initialize_repository_version(repo, hash_algo_by_ptr(repo->hash_algo), format, 1); |
3507 | 3502 |
|
3508 | 3503 | /* |
3509 | 3504 | * Unset the old ref store and release it. `get_main_ref_store()` will |
|
0 commit comments