@@ -4,7 +4,7 @@ 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
+repository are used to store the configuration for that repository, and
`$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.
@@ -221,7 +221,7 @@ $ git config extensions.worktreeConfig true
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.
+versions will refuse to access repositories with this extension.
Note that in this file, the exception for `core.bare` and `core.worktree`
is gone. If you have them in $GIT_DIR/config before, you must move
@@ -283,6 +283,9 @@ to `/path/main/.git/worktrees/test-next` then a file named
`test-next` entry from being pruned. See
linkgit:gitrepository-layout[5] for details.
+When extensions.worktreeConfig is enabled, the config file
+`.git/worktrees/<id>/config.worktree` is read after `.git/config` is.
+
LIST OUTPUT FORMAT
------------------
The worktree list command has two output formats. The default format shows the
@@ -747,28 +747,27 @@ test_cmp() {
$GIT_TEST_CMP "$@"
}
-# similar to test_cmp but $2 is a config key instead of actual value
-# it can also accept -C to read from a different repo, e.g.
+# Check that the given config key has the expected value.
#
-# test_cmp_config -C xyz foo core.bar
+# test_cmp_config [-C <dir>] <expected-value>
+# [<git-config-options>...] <config-key>
#
-# is sort of equivalent of
+# for example to check that the value of core.bar is foo
+#
+# test_cmp_config foo core.bar
#
-# test "foo" = "$(git -C xyz core.bar)"
-
test_cmp_config() {
- if [ "$1" = "-C" ]
+ local GD
+ if test "$1" = "-C"
then
shift &&
GD="-C $1" &&
shift
- else
- GD=
fi &&
- echo "$1" >expected &&
+ printf "%s\n" "$1" >expect.config &&
shift &&
- git $GD config "$@" >actual &&
- test_cmp expected actual
+ git $GD config "$@" >actual.config &&
+ test_cmp expect.config actual.config
}
# test_cmp_bin - helper to compare binary files