On Sat, Sep 29, 2018 at 11:30 AM Nguyễn Thái Ngọc Duy <[email protected]> wrote:
> A new repo extension is added, worktreeConfig. When it is present:
> [...]
> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
> ---
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> @@ -2,8 +2,9 @@ CONFIGURATION FILE
> The Git configuration file contains a number of variables that affect
> +the Git commands' behavior. The files `.git/config` and optionally
> +`config.worktree` (see `extensions.worktreeConfig` below) in each
> +repository is used to store the configuration for that repository, and
s/is used/are/used/
> `$HOME/.gitconfig` is used to store a per-user configuration as
> fallback values for the `.git/config` file. The file `/etc/gitconfig`
> can be used to store a system-wide default configuration.
> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
> @@ -204,6 +204,36 @@ working trees, it can be used to identify worktrees. For
> example if
> +CONFIGURATION FILE
> +------------------
> +In this mode, specific configuration stays in the path pointed by `git
> +rev-parse --git-path config.worktree`. You can add or update
> +configuration in this file with `git config --worktree`. Older Git
> +versions may will refuse to access repositories with this extension.
s/may will/will/
> diff --git a/Documentation/gitrepository-layout.txt
> b/Documentation/gitrepository-layout.txt
> @@ -275,6 +280,9 @@ worktrees/<id>/locked::
> +worktrees/<id>/config.worktree::
> + Working directory specific configuration file.
I wonder if this deserves a quick mention in
Documentation/git-worktree.txt since other worktree-related files,
such as "worktrees/<id>/locked", are mentioned there.
> diff --git a/builtin/config.c b/builtin/config.c
> @@ -645,7 +649,20 @@ int cmd_config(int argc, const char **argv, const char
> *prefix)
> + else if (use_worktree_config) {
> + struct worktree **worktrees = get_worktrees(0);
> + if (repository_format_worktree_config)
> + given_config_source.file =
> git_pathdup("config.worktree");
> + else if (worktrees[0] && worktrees[1])
> + die(_("--worktree cannot be used with multiple "
> + "working trees unless the config\n"
> + "extension worktreeConfig is enabled. "
> + "Please read \"CONFIGURATION FILE\"\n"
> + "section in \"git help worktree\" for
> details"));
> + else
> + given_config_source.file = git_pathdup("config");
I'm not sure I understand the purpose of allowing --worktree when only
a single worktree is present and extensions.worktreeConfig is not set.
Can you talk about it a bit more?