* When in a secondary worktree, and when extensions.worktreeConfig * is true, only $commondir/config and $commondir/worktrees/ / * config.worktree are consulted, hence any core.bare=true setting in * $commondir/config.worktree gets overlooked. Thus, check it manually * to determine if the repository is bare. */
| 94 | * to determine if the repository is bare. |
| 95 | */ |
| 96 | static int is_main_worktree_bare(struct repository *repo) |
| 97 | { |
| 98 | int bare = 0; |
| 99 | struct config_set cs = {0}; |
| 100 | char *worktree_config = xstrfmt("%s/config.worktree", repo_get_common_dir(repo)); |
| 101 | |
| 102 | git_configset_init(&cs); |
| 103 | git_configset_add_file(&cs, worktree_config); |
| 104 | git_configset_get_bool(&cs, "core.bare", &bare); |
| 105 | |
| 106 | git_configset_clear(&cs); |
| 107 | free(worktree_config); |
| 108 | return bare; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * get the main worktree |
no test coverage detected