summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-11-13 22:37:18 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-11-13 22:37:18 +0900
commit8c758f9a67a265ae51beddfd9895d48a42c2af13 (patch)
tree555c2d42a1ef3f8d69c64a77fbdb0690d529ff3b /config.c
parentMerge branch 'jk/stream-pack-non-delta-clarification' (diff)
parentworktree: add per-worktree config files (diff)
downloadtgif-8c758f9a67a265ae51beddfd9895d48a42c2af13.tar.xz
Merge branch 'nd/per-worktree-config'
A fourth class of configuration files (in addition to the traditional "system wide", "per user in the $HOME directory" and "per repository in the $GIT_DIR/config") has been introduced so that different worktrees that share the same repository (hence the same $GIT_DIR/config file) can use different customization. * nd/per-worktree-config: worktree: add per-worktree config files t1300: extract and use test_cmp_config()
Diffstat (limited to 'config.c')
-rw-r--r--config.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/config.c b/config.c
index 4051e38823..aa0ed854f6 100644
--- a/config.c
+++ b/config.c
@@ -1695,6 +1695,17 @@ static int do_git_config_sequence(const struct config_options *opts,
if (repo_config && !access_or_die(repo_config, R_OK, 0))
ret += git_config_from_file(fn, repo_config, data);
+ /*
+ * Note: this should have a new scope, CONFIG_SCOPE_WORKTREE.
+ * But let's not complicate things before it's actually needed.
+ */
+ if (repository_format_worktree_config) {
+ char *path = git_pathdup("config.worktree");
+ if (!access_or_die(path, R_OK, 0))
+ ret += git_config_from_file(fn, path, data);
+ free(path);
+ }
+
current_parsing_scope = CONFIG_SCOPE_CMDLINE;
if (git_config_from_parameters(fn, data) < 0)
die(_("unable to parse command-line config"));