summaryrefslogtreecommitdiff
path: root/builtin/config.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-03-01 11:26:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-12 03:56:16 (GMT)
commit3efd0bedc6625a6b194c1f6e5f1b7aa7d8b7e6bb (patch)
treee4de0de77a6a7c8bd73e4324835dc3a76b2d1654 /builtin/config.c
parent1050e9874b708c3a65afc5af689ad2efe4df9053 (diff)
downloadgit-3efd0bedc6625a6b194c1f6e5f1b7aa7d8b7e6bb.zip
git-3efd0bedc6625a6b194c1f6e5f1b7aa7d8b7e6bb.tar.gz
git-3efd0bedc6625a6b194c1f6e5f1b7aa7d8b7e6bb.tar.bz2
config: add conditional include
Sometimes a set of repositories want to share configuration settings among themselves that are distinct from other such sets of repositories. A user may work on two projects, each of which have multiple repositories, and use one user.email for one project while using another for the other. Setting $GIT_DIR/.config works, but if the penalty of forgetting to update $GIT_DIR/.config is high (especially when you end up cloning often), it may not be the best way to go. Having the settings in ~/.gitconfig, which would work for just one set of repositories, would not well in such a situation. Having separate ${HOME}s may add more problems than it solves. Extend the include.path mechanism that lets a config file include another config file, so that the inclusion can be done only when some conditions hold. Then ~/.gitconfig can say "include config-project-A only when working on project-A" for each project A the user works on. In this patch, the only supported grouping is based on $GIT_DIR (in absolute path), so you would need to group repositories by directory, or something like that to take advantage of it. We already have include.path for unconditional includes. This patch goes with includeIf.<condition>.path to make it clearer that a condition is required. The new config has the same backward compatibility approach as include.path: older git versions that don't understand includeIf will simply ignore them. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/config.c')
0 files changed, 0 insertions, 0 deletions