2006-04-24 22:59:33 +00:00
|
|
|
CONFIGURATION FILE
|
|
|
|
------------------
|
|
|
|
|
2013-01-21 19:17:53 +00:00
|
|
|
The Git configuration file contains a number of variables that affect
|
2018-10-21 14:02:28 +00:00
|
|
|
the Git commands' behavior. The files `.git/config` and optionally
|
2020-04-25 01:05:38 +00:00
|
|
|
`config.worktree` (see the "CONFIGURATION FILE" section of
|
|
|
|
linkgit:git-worktree[1]) in each 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.
|
2007-01-17 06:45:35 +00:00
|
|
|
|
2013-01-21 19:17:53 +00:00
|
|
|
The configuration variables are used by both the Git plumbing
|
2023-10-08 06:45:03 +00:00
|
|
|
and the porcelain commands. The variables are divided into sections, wherein
|
2009-04-23 09:38:01 +00:00
|
|
|
the fully qualified variable name of the variable itself is the last
|
2006-04-24 22:59:33 +00:00
|
|
|
dot-separated segment and the section name is everything before the last
|
2012-03-01 10:59:45 +00:00
|
|
|
dot. The variable names are case-insensitive, allow only alphanumeric
|
|
|
|
characters and `-`, and must start with an alphabetic character. Some
|
2015-03-04 18:26:17 +00:00
|
|
|
variables may appear multiple times; we say then that the variable is
|
|
|
|
multivalued.
|
2006-04-24 22:59:33 +00:00
|
|
|
|
2007-01-22 15:25:47 +00:00
|
|
|
Syntax
|
|
|
|
~~~~~~
|
|
|
|
|
2006-04-24 22:59:33 +00:00
|
|
|
The syntax is fairly flexible and permissive; whitespaces are mostly
|
2007-01-22 15:25:47 +00:00
|
|
|
ignored. The '#' and ';' characters begin comments to the end of line,
|
|
|
|
blank lines are ignored.
|
|
|
|
|
|
|
|
The file consists of sections and variables. A section begins with
|
|
|
|
the name of the section in square brackets and continues until the next
|
2015-03-04 04:03:50 +00:00
|
|
|
section begins. Section names are case-insensitive. Only alphanumeric
|
2009-03-15 11:30:52 +00:00
|
|
|
characters, `-` and `.` are allowed in section names. Each variable
|
2009-04-23 09:38:00 +00:00
|
|
|
must belong to some section, which means that there must be a section
|
|
|
|
header before the first setting of a variable.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
|
|
|
Sections can be further divided into subsections. To begin a subsection
|
|
|
|
put its name in double quotes, separated by space from the section name,
|
2009-04-23 09:38:00 +00:00
|
|
|
in the section header, like in the example below:
|
2007-01-22 15:25:47 +00:00
|
|
|
|
|
|
|
--------
|
|
|
|
[section "subsection"]
|
|
|
|
|
|
|
|
--------
|
|
|
|
|
2009-04-23 09:38:01 +00:00
|
|
|
Subsection names are case sensitive and can contain any characters except
|
2017-12-21 13:10:42 +00:00
|
|
|
newline and the null byte. Doublequote `"` and backslash can be included
|
|
|
|
by escaping them as `\"` and `\\`, respectively. Backslashes preceding
|
|
|
|
other characters are dropped when reading; for example, `\t` is read as
|
2021-03-16 14:40:40 +00:00
|
|
|
`t` and `\0` is read as `0`. Section headers cannot span multiple lines.
|
2017-12-21 13:10:42 +00:00
|
|
|
Variables may belong directly to a section or to a given subsection. You
|
|
|
|
can have `[section]` if you have `[section "subsection"]`, but you don't
|
|
|
|
need to.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
2011-10-12 15:52:06 +00:00
|
|
|
There is also a deprecated `[section.subsection]` syntax. With this
|
|
|
|
syntax, the subsection name is converted to lower-case and is also
|
|
|
|
compared case sensitively. These subsection names follow the same
|
|
|
|
restrictions as section names.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
2009-07-25 00:28:50 +00:00
|
|
|
All the other lines (and the remainder of the line after the section
|
|
|
|
header) are recognized as setting variables, in the form
|
2015-03-04 19:08:34 +00:00
|
|
|
'name = value' (or just 'name', which is a short-hand to say that
|
|
|
|
the variable is the boolean "true").
|
2012-03-01 10:59:45 +00:00
|
|
|
The variable names are case-insensitive, allow only alphanumeric characters
|
2015-03-04 18:26:17 +00:00
|
|
|
and `-`, and must start with an alphabetic character.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
2015-03-04 18:33:38 +00:00
|
|
|
A line that defines a value can be continued to the next line by
|
2020-12-01 12:10:51 +00:00
|
|
|
ending it with a `\`; the backslash and the end-of-line are
|
2015-03-04 18:33:38 +00:00
|
|
|
stripped. Leading whitespaces after 'name =', the remainder of the
|
|
|
|
line after the first comment character '#' or ';', and trailing
|
|
|
|
whitespaces of the line are discarded unless they are enclosed in
|
|
|
|
double quotes. Internal whitespaces within the value are retained
|
|
|
|
verbatim.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
2015-03-04 18:33:38 +00:00
|
|
|
Inside double quotes, double quote `"` and backslash `\` characters
|
|
|
|
must be escaped: use `\"` for `"` and `\\` for `\`.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
2009-03-15 11:30:52 +00:00
|
|
|
The following escape sequences (beside `\"` and `\\`) are recognized:
|
|
|
|
`\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)
|
2014-03-31 22:11:44 +00:00
|
|
|
and `\b` for backspace (BS). Other char escape sequences (including octal
|
|
|
|
escape sequences) are invalid.
|
2007-01-22 15:25:47 +00:00
|
|
|
|
2006-04-24 22:59:33 +00:00
|
|
|
|
config: add include directive
It can be useful to split your ~/.gitconfig across multiple
files. For example, you might have a "main" file which is
used on many machines, but a small set of per-machine
tweaks. Or you may want to make some of your config public
(e.g., clever aliases) while keeping other data back (e.g.,
your name or other identifying information). Or you may want
to include a number of config options in some subset of your
repos without copying and pasting (e.g., you want to
reference them from the .git/config of participating repos).
This patch introduces an include directive for config files.
It looks like:
[include]
path = /path/to/file
This is syntactically backwards-compatible with existing git
config parsers (i.e., they will see it as another config
entry and ignore it unless you are looking up include.path).
The implementation provides a "git_config_include" callback
which wraps regular config callbacks. Callers can pass it to
git_config_from_file, and it will transparently follow any
include directives, passing all of the discovered options to
the real callback.
Include directives are turned on automatically for "regular"
git config parsing. This includes calls to git_config, as
well as calls to the "git config" program that do not
specify a single file (e.g., using "-f", "--global", etc).
They are not turned on in other cases, including:
1. Parsing of other config-like files, like .gitmodules.
There isn't a real need, and I'd rather be conservative
and avoid unnecessary incompatibility or confusion.
2. Reading single files via "git config". This is for two
reasons:
a. backwards compatibility with scripts looking at
config-like files.
b. inspection of a specific file probably means you
care about just what's in that file, not a general
lookup for "do we have this value anywhere at
all". If that is not the case, the caller can
always specify "--includes".
3. Writing files via "git config"; we want to treat
include.* variables as literal items to be copied (or
modified), and not expand them. So "git config
--unset-all foo.bar" would operate _only_ on
.git/config, not any of its included files (just as it
also does not operate on ~/.gitconfig).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-06 09:54:04 +00:00
|
|
|
Includes
|
|
|
|
~~~~~~~~
|
|
|
|
|
2017-05-11 09:10:47 +00:00
|
|
|
The `include` and `includeIf` sections allow you to include config
|
|
|
|
directives from another source. These sections behave identically to
|
|
|
|
each other with the exception that `includeIf` sections may be ignored
|
|
|
|
if their condition does not evaluate to true; see "Conditional includes"
|
|
|
|
below.
|
|
|
|
|
2017-03-01 11:26:29 +00:00
|
|
|
You can include a config file from another by setting the special
|
2017-05-11 09:10:47 +00:00
|
|
|
`include.path` (or `includeIf.*.path`) variable to the name of the file
|
|
|
|
to be included. The variable takes a pathname as its value, and is
|
|
|
|
subject to tilde expansion. These variables can be given multiple times.
|
2016-04-29 17:43:55 +00:00
|
|
|
|
2017-05-11 09:13:04 +00:00
|
|
|
The contents of the included file are inserted immediately, as if they
|
|
|
|
had been found at the location of the include directive. If the value of the
|
2017-05-11 09:10:47 +00:00
|
|
|
variable is a relative path, the path is considered to
|
2017-03-01 11:26:30 +00:00
|
|
|
be relative to the configuration file in which the include directive
|
|
|
|
was found. See below for examples.
|
2016-04-29 17:43:55 +00:00
|
|
|
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
Conditional includes
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2023-10-08 06:45:16 +00:00
|
|
|
You can conditionally include a config file from another by setting an
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
`includeIf.<condition>.path` variable to the name of the file to be
|
2017-05-11 09:10:47 +00:00
|
|
|
included.
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
|
|
|
|
The condition starts with a keyword followed by a colon and some data
|
|
|
|
whose format and meaning depends on the keyword. Supported keywords
|
|
|
|
are:
|
|
|
|
|
|
|
|
`gitdir`::
|
|
|
|
|
|
|
|
The data that follows the keyword `gitdir:` is used as a glob
|
|
|
|
pattern. If the location of the .git directory matches the
|
|
|
|
pattern, the include condition is met.
|
|
|
|
+
|
|
|
|
The .git location may be auto-discovered, or come from `$GIT_DIR`
|
2023-10-08 06:45:19 +00:00
|
|
|
environment variable. If the repository is auto-discovered via a .git
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
file (e.g. from submodules, or a linked worktree), the .git location
|
|
|
|
would be the final location where the .git directory is, not where the
|
|
|
|
.git file is.
|
|
|
|
+
|
|
|
|
The pattern can contain standard globbing wildcards and two additional
|
|
|
|
ones, `**/` and `/**`, that can match multiple path components. Please
|
|
|
|
refer to linkgit:gitignore[5] for details. For convenience:
|
|
|
|
|
|
|
|
* If the pattern starts with `~/`, `~` will be substituted with the
|
|
|
|
content of the environment variable `HOME`.
|
|
|
|
|
|
|
|
* If the pattern starts with `./`, it is replaced with the directory
|
|
|
|
containing the current config file.
|
|
|
|
|
|
|
|
* If the pattern does not start with either `~/`, `./` or `/`, `**/`
|
|
|
|
will be automatically prepended. For example, the pattern `foo/bar`
|
|
|
|
becomes `**/foo/bar` and would match `/any/path/to/foo/bar`.
|
|
|
|
|
|
|
|
* If the pattern ends with `/`, `**` will be automatically added. For
|
|
|
|
example, the pattern `foo/` becomes `foo/**`. In other words, it
|
|
|
|
matches "foo" and everything inside, recursively.
|
|
|
|
|
|
|
|
`gitdir/i`::
|
|
|
|
This is the same as `gitdir` except that matching is done
|
2019-11-05 17:07:20 +00:00
|
|
|
case-insensitively (e.g. on case-insensitive file systems)
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
|
2019-06-05 21:21:59 +00:00
|
|
|
`onbranch`::
|
|
|
|
The data that follows the keyword `onbranch:` is taken to be a
|
|
|
|
pattern with standard globbing wildcards and two additional
|
|
|
|
ones, `**/` and `/**`, that can match multiple path components.
|
|
|
|
If we are in a worktree where the name of the branch that is
|
|
|
|
currently checked out matches the pattern, the include condition
|
|
|
|
is met.
|
|
|
|
+
|
|
|
|
If the pattern ends with `/`, `**` will be automatically added. For
|
|
|
|
example, the pattern `foo/` becomes `foo/**`. In other words, it matches
|
|
|
|
all branches that begin with `foo/`. This is useful if your branches are
|
|
|
|
organized hierarchically and you would like to apply a configuration to
|
|
|
|
all the branches in that hierarchy.
|
|
|
|
|
2022-01-18 17:47:40 +00:00
|
|
|
`hasconfig:remote.*.url:`::
|
|
|
|
The data that follows this keyword is taken to
|
|
|
|
be a pattern with standard globbing wildcards and two
|
|
|
|
additional ones, `**/` and `/**`, that can match multiple
|
|
|
|
components. The first time this keyword is seen, the rest of
|
|
|
|
the config files will be scanned for remote URLs (without
|
|
|
|
applying any values). If there exists at least one remote URL
|
|
|
|
that matches this pattern, the include condition is met.
|
|
|
|
+
|
|
|
|
Files included by this option (directly or indirectly) are not allowed
|
|
|
|
to contain remote URLs.
|
|
|
|
+
|
|
|
|
Note that unlike other includeIf conditions, resolving this condition
|
|
|
|
relies on information that is not yet known at the point of reading the
|
|
|
|
condition. A typical use case is this option being present as a
|
|
|
|
system-level or global-level config, and the remote URL being in a
|
|
|
|
local-level config; hence the need to scan ahead when resolving this
|
|
|
|
condition. In order to avoid the chicken-and-egg problem in which
|
|
|
|
potentially-included files can affect whether such files are potentially
|
|
|
|
included, Git breaks the cycle by prohibiting these files from affecting
|
|
|
|
the resolution of these conditions (thus, prohibiting them from
|
|
|
|
declaring remote URLs).
|
|
|
|
+
|
2023-06-07 19:26:47 +00:00
|
|
|
As for the naming of this keyword, it is for forwards compatibility with
|
2022-01-18 17:47:40 +00:00
|
|
|
a naming scheme that supports more variable-based include conditions,
|
|
|
|
but currently Git only supports the exact keyword described above.
|
|
|
|
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
A few more notes on matching via `gitdir` and `gitdir/i`:
|
|
|
|
|
|
|
|
* Symlinks in `$GIT_DIR` are not resolved before matching.
|
|
|
|
|
2017-05-16 08:28:46 +00:00
|
|
|
* Both the symlink & realpath versions of paths will be matched
|
|
|
|
outside of `$GIT_DIR`. E.g. if ~/git is a symlink to
|
|
|
|
/mnt/storage/git, both `gitdir:~/git` and `gitdir:/mnt/storage/git`
|
|
|
|
will match.
|
|
|
|
+
|
|
|
|
This was not the case in the initial release of this feature in
|
|
|
|
v2.13.0, which only matched the realpath version. Configuration that
|
|
|
|
wants to be compatible with the initial release of this feature needs
|
|
|
|
to either specify only the realpath version, or both versions.
|
|
|
|
|
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>
2017-03-01 11:26:31 +00:00
|
|
|
* Note that "../" is not special and will match literally, which is
|
|
|
|
unlikely what you want.
|
config: add include directive
It can be useful to split your ~/.gitconfig across multiple
files. For example, you might have a "main" file which is
used on many machines, but a small set of per-machine
tweaks. Or you may want to make some of your config public
(e.g., clever aliases) while keeping other data back (e.g.,
your name or other identifying information). Or you may want
to include a number of config options in some subset of your
repos without copying and pasting (e.g., you want to
reference them from the .git/config of participating repos).
This patch introduces an include directive for config files.
It looks like:
[include]
path = /path/to/file
This is syntactically backwards-compatible with existing git
config parsers (i.e., they will see it as another config
entry and ignore it unless you are looking up include.path).
The implementation provides a "git_config_include" callback
which wraps regular config callbacks. Callers can pass it to
git_config_from_file, and it will transparently follow any
include directives, passing all of the discovered options to
the real callback.
Include directives are turned on automatically for "regular"
git config parsing. This includes calls to git_config, as
well as calls to the "git config" program that do not
specify a single file (e.g., using "-f", "--global", etc).
They are not turned on in other cases, including:
1. Parsing of other config-like files, like .gitmodules.
There isn't a real need, and I'd rather be conservative
and avoid unnecessary incompatibility or confusion.
2. Reading single files via "git config". This is for two
reasons:
a. backwards compatibility with scripts looking at
config-like files.
b. inspection of a specific file probably means you
care about just what's in that file, not a general
lookup for "do we have this value anywhere at
all". If that is not the case, the caller can
always specify "--includes".
3. Writing files via "git config"; we want to treat
include.* variables as literal items to be copied (or
modified), and not expand them. So "git config
--unset-all foo.bar" would operate _only_ on
.git/config, not any of its included files (just as it
also does not operate on ~/.gitconfig).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-06 09:54:04 +00:00
|
|
|
|
2006-04-24 22:59:33 +00:00
|
|
|
Example
|
|
|
|
~~~~~~~
|
|
|
|
|
2019-09-07 14:12:49 +00:00
|
|
|
----
|
|
|
|
# Core variables
|
|
|
|
[core]
|
|
|
|
; Don't trust file modes
|
|
|
|
filemode = false
|
|
|
|
|
|
|
|
# Our diff algorithm
|
|
|
|
[diff]
|
|
|
|
external = /usr/local/bin/diff-wrapper
|
|
|
|
renames = true
|
|
|
|
|
|
|
|
[branch "devel"]
|
|
|
|
remote = origin
|
|
|
|
merge = refs/heads/devel
|
|
|
|
|
|
|
|
# Proxy settings
|
|
|
|
[core]
|
|
|
|
gitProxy="ssh" for "kernel.org"
|
|
|
|
gitProxy=default-proxy ; for the rest
|
|
|
|
|
|
|
|
[include]
|
|
|
|
path = /path/to/foo.inc ; include by absolute path
|
|
|
|
path = foo.inc ; find "foo.inc" relative to the current file
|
|
|
|
path = ~/foo.inc ; find "foo.inc" in your `$HOME` directory
|
|
|
|
|
|
|
|
; include if $GIT_DIR is /path/to/foo/.git
|
|
|
|
[includeIf "gitdir:/path/to/foo/.git"]
|
|
|
|
path = /path/to/foo.inc
|
|
|
|
|
|
|
|
; include for all repositories inside /path/to/group
|
|
|
|
[includeIf "gitdir:/path/to/group/"]
|
|
|
|
path = /path/to/foo.inc
|
|
|
|
|
|
|
|
; include for all repositories inside $HOME/to/group
|
|
|
|
[includeIf "gitdir:~/to/group/"]
|
|
|
|
path = /path/to/foo.inc
|
|
|
|
|
|
|
|
; relative paths are always relative to the including
|
|
|
|
; file (if the condition is true); their location is not
|
|
|
|
; affected by the condition
|
|
|
|
[includeIf "gitdir:/path/to/group/"]
|
|
|
|
path = foo.inc
|
2017-05-11 09:11:06 +00:00
|
|
|
|
2020-04-09 10:35:41 +00:00
|
|
|
; include only if we are in a worktree where foo-branch is
|
|
|
|
; currently checked out
|
|
|
|
[includeIf "onbranch:foo-branch"]
|
|
|
|
path = foo.inc
|
2022-01-18 17:47:40 +00:00
|
|
|
|
|
|
|
; include only if a remote with the given URL exists (note
|
|
|
|
; that such a URL may be provided later in a file or in a
|
|
|
|
; file read after this file is read, as seen in this example)
|
|
|
|
[includeIf "hasconfig:remote.*.url:https://example.com/**"]
|
|
|
|
path = foo.inc
|
|
|
|
[remote "origin"]
|
|
|
|
url = https://example.com/git
|
2020-04-09 10:35:41 +00:00
|
|
|
----
|
2019-06-05 21:21:59 +00:00
|
|
|
|
2015-03-04 18:57:43 +00:00
|
|
|
Values
|
|
|
|
~~~~~~
|
|
|
|
|
|
|
|
Values of many variables are treated as a simple string, but there
|
|
|
|
are variables that take values of specific types and there are rules
|
|
|
|
as to how to spell them.
|
|
|
|
|
|
|
|
boolean::
|
|
|
|
|
|
|
|
When a variable is said to take a boolean value, many
|
|
|
|
synonyms are accepted for 'true' and 'false'; these are all
|
|
|
|
case-insensitive.
|
|
|
|
|
2017-08-14 22:12:18 +00:00
|
|
|
true;; Boolean true literals are `yes`, `on`, `true`,
|
|
|
|
and `1`. Also, a variable defined without `= <value>`
|
2015-03-04 18:57:43 +00:00
|
|
|
is taken as true.
|
|
|
|
|
2017-08-14 22:12:18 +00:00
|
|
|
false;; Boolean false literals are `no`, `off`, `false`,
|
|
|
|
`0` and the empty string.
|
2015-03-04 18:57:43 +00:00
|
|
|
+
|
2018-09-19 16:38:18 +00:00
|
|
|
When converting a value to its canonical form using the `--type=bool` type
|
2017-08-14 22:12:18 +00:00
|
|
|
specifier, 'git config' will ensure that the output is "true" or
|
2015-03-04 18:57:43 +00:00
|
|
|
"false" (spelled in lowercase).
|
|
|
|
|
|
|
|
integer::
|
|
|
|
The value for many variables that specify various sizes can
|
|
|
|
be suffixed with `k`, `M`,... to mean "scale the number by
|
|
|
|
1024", "by 1024x1024", etc.
|
|
|
|
|
2015-03-04 07:07:13 +00:00
|
|
|
color::
|
2016-06-23 17:32:30 +00:00
|
|
|
The value for a variable that takes a color is a list of
|
|
|
|
colors (at most two, one for foreground and one for background)
|
|
|
|
and attributes (as many as you want), separated by spaces.
|
2015-03-20 20:50:51 +00:00
|
|
|
+
|
2021-10-25 22:32:36 +00:00
|
|
|
The basic colors accepted are `normal`, `black`, `red`, `green`,
|
|
|
|
`yellow`, `blue`, `magenta`, `cyan`, `white` and `default`. The first
|
|
|
|
color given is the foreground; the second is the background. All the
|
|
|
|
basic colors except `normal` and `default` have a bright variant that can
|
|
|
|
be specified by prefixing the color with `bright`, like `brightred`.
|
|
|
|
+
|
|
|
|
The color `normal` makes no change to the color. It is the same as an
|
|
|
|
empty string, but can be used as the foreground color when specifying a
|
|
|
|
background color alone (for example, "normal red").
|
|
|
|
+
|
|
|
|
The color `default` explicitly resets the color to the terminal default,
|
|
|
|
for example to specify a cleared background. Although it varies between
|
|
|
|
terminals, this is usually not the same as setting to "white black".
|
log --decorate: do not leak "commit" color into the next item
In "git log --decorate", you would see the commit header like this:
commit ... (HEAD, jc/decorate-leaky-separator-color)
where "commit ... (" is painted in color.diff.commit, "HEAD" in
color.decorate.head, ", " in color.diff.commit, the branch name in
color.decorate.branch and then closing ")" in color.diff.commit.
If you wanted to paint the HEAD and local branch name in the same
color as the body text (perhaps because cyan and green are too faint
on a black-on-white terminal to be readable), you would not want to
have to say
[color "decorate"]
head = black
branch = black
because that you would not be able to reuse same configuration on a
white-on-black terminal. You would naively expect
[color "decorate"]
head = normal
branch = normal
to work, but unfortunately it does not. It paints the string "HEAD"
and the branch name in the same color as the opening parenthesis or
comma between the decoration elements. This is because the code
forgets to reset the color after printing the "prefix" in its own
color.
It theoretically is possible that some people were expecting and
relying on that the attribute set as the "diff.commit" color, which
is used to draw these opening parenthesis and inter-item comma, is
inherited by the drawing of branch names, but it is not how the
coloring works everywhere else.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-04 19:07:12 +00:00
|
|
|
+
|
2016-06-23 17:32:30 +00:00
|
|
|
Colors may also be given as numbers between 0 and 255; these use ANSI
|
|
|
|
256-color mode (but note that not all terminals may support this). If
|
|
|
|
your terminal supports it, you may also specify 24-bit RGB values as
|
|
|
|
hex, like `#ff0ab3`.
|
|
|
|
+
|
2016-06-23 17:40:16 +00:00
|
|
|
The accepted attributes are `bold`, `dim`, `ul`, `blink`, `reverse`,
|
|
|
|
`italic`, and `strike` (for crossed-out or "strikethrough" letters).
|
|
|
|
The position of any attributes with respect to the colors
|
2016-06-23 17:39:07 +00:00
|
|
|
(before, after, or in between), doesn't matter. Specific attributes may
|
|
|
|
be turned off by prefixing them with `no` or `no-` (e.g., `noreverse`,
|
|
|
|
`no-ul`, etc).
|
2016-06-23 17:32:30 +00:00
|
|
|
+
|
2021-10-26 01:03:47 +00:00
|
|
|
The pseudo-attribute `reset` resets all colors and attributes before
|
|
|
|
applying the specified coloring. For example, `reset green` will result
|
|
|
|
in a green foreground and default background without any active
|
|
|
|
attributes.
|
|
|
|
+
|
2017-02-02 12:42:44 +00:00
|
|
|
An empty color string produces no color effect at all. This can be used
|
|
|
|
to avoid coloring specific elements without disabling color entirely.
|
|
|
|
+
|
2016-06-23 17:32:30 +00:00
|
|
|
For git's pre-defined color slots, the attributes are meant to be reset
|
|
|
|
at the beginning of each item in the colored output. So setting
|
|
|
|
`color.decorate.branch` to `black` will paint that branch name in a
|
|
|
|
plain `black`, even if the previous thing on the same output line (e.g.
|
|
|
|
opening parenthesis before the list of branch names in `log --decorate`
|
|
|
|
output) is set to be painted with `bold` or some other attribute.
|
|
|
|
However, custom log formats may do more complicated and layered
|
|
|
|
coloring, and the negated forms may be useful there.
|
2015-03-04 07:07:13 +00:00
|
|
|
|
2016-04-29 17:43:55 +00:00
|
|
|
pathname::
|
|
|
|
A variable that takes a pathname value can be given a
|
|
|
|
string that begins with "`~/`" or "`~user/`", and the usual
|
|
|
|
tilde expansion happens to such a string: `~/`
|
|
|
|
is expanded to the value of `$HOME`, and `~user/` to the
|
|
|
|
specified user's home directory.
|
interpolate_path(): allow specifying paths relative to the runtime prefix
Ever since Git learned to detect its install location at runtime, there
was the slightly awkward problem that it was impossible to specify paths
relative to said location.
For example, if a version of Git was shipped with custom SSL
certificates to use, there was no portable way to specify
`http.sslCAInfo`.
In Git for Windows, the problem was "solved" for years by interpreting
paths starting with a slash as relative to the runtime prefix.
However, this is not correct: such paths _are_ legal on Windows, and
they are interpreted as absolute paths in the same drive as the current
directory.
After a lengthy discussion, and an even lengthier time to mull over the
problem and its best solution, and then more discussions, we eventually
decided to introduce support for the magic sequence `%(prefix)/`. If a
path starts with this, the remainder is interpreted as relative to the
detected (runtime) prefix. If built without runtime prefix support, Git
will simply interpolate the compiled-in prefix.
If a user _wants_ to specify a path starting with the magic sequence,
they can prefix the magic sequence with `./` and voilà, the path won't
be expanded.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-07-24 22:06:53 +00:00
|
|
|
+
|
|
|
|
If a path starts with `%(prefix)/`, the remainder is interpreted as a
|
|
|
|
path relative to Git's "runtime prefix", i.e. relative to the location
|
|
|
|
where Git itself was installed. For example, `%(prefix)/bin/` refers to
|
|
|
|
the directory in which the Git executable itself lives. If Git was
|
|
|
|
compiled without runtime prefix support, the compiled-in prefix will be
|
2021-10-24 17:07:43 +00:00
|
|
|
substituted instead. In the unlikely event that a literal path needs to
|
interpolate_path(): allow specifying paths relative to the runtime prefix
Ever since Git learned to detect its install location at runtime, there
was the slightly awkward problem that it was impossible to specify paths
relative to said location.
For example, if a version of Git was shipped with custom SSL
certificates to use, there was no portable way to specify
`http.sslCAInfo`.
In Git for Windows, the problem was "solved" for years by interpreting
paths starting with a slash as relative to the runtime prefix.
However, this is not correct: such paths _are_ legal on Windows, and
they are interpreted as absolute paths in the same drive as the current
directory.
After a lengthy discussion, and an even lengthier time to mull over the
problem and its best solution, and then more discussions, we eventually
decided to introduce support for the magic sequence `%(prefix)/`. If a
path starts with this, the remainder is interpreted as relative to the
detected (runtime) prefix. If built without runtime prefix support, Git
will simply interpolate the compiled-in prefix.
If a user _wants_ to specify a path starting with the magic sequence,
they can prefix the magic sequence with `./` and voilà, the path won't
be expanded.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-07-24 22:06:53 +00:00
|
|
|
be specified that should _not_ be expanded, it needs to be prefixed by
|
|
|
|
`./`, like so: `./%(prefix)/bin`.
|
2016-04-29 17:43:55 +00:00
|
|
|
|
2015-03-04 18:57:43 +00:00
|
|
|
|
2006-04-24 22:59:33 +00:00
|
|
|
Variables
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
Note that this list is non-comprehensive and not necessarily complete.
|
2006-06-07 23:15:05 +00:00
|
|
|
For command-specific variables, you will find a more detailed description
|
2014-03-21 04:07:08 +00:00
|
|
|
in the appropriate manual page.
|
|
|
|
|
|
|
|
Other git-related tools may and do use their own variables. When
|
|
|
|
inventing new variables for use in your own tool, make sure their
|
|
|
|
names do not conflict with those that are used by Git itself and
|
|
|
|
other popular tools, and describe them in your documentation.
|
|
|
|
|
2018-10-27 06:22:35 +00:00
|
|
|
include::config/advice.txt[]
|
2009-09-09 11:38:58 +00:00
|
|
|
|
2023-10-13 17:39:30 +00:00
|
|
|
include::config/attr.txt[]
|
|
|
|
|
2018-10-27 06:22:36 +00:00
|
|
|
include::config/core.txt[]
|
2010-10-28 18:28:04 +00:00
|
|
|
|
2018-10-27 06:22:37 +00:00
|
|
|
include::config/add.txt[]
|
2009-05-31 05:08:02 +00:00
|
|
|
|
2018-10-27 06:22:38 +00:00
|
|
|
include::config/alias.txt[]
|
2007-02-11 00:33:58 +00:00
|
|
|
|
2018-10-27 06:22:39 +00:00
|
|
|
include::config/am.txt[]
|
2015-08-04 14:19:26 +00:00
|
|
|
|
2018-10-27 06:22:40 +00:00
|
|
|
include::config/apply.txt[]
|
2006-04-24 22:59:33 +00:00
|
|
|
|
2018-10-27 06:22:41 +00:00
|
|
|
include::config/blame.txt[]
|
2018-08-04 06:25:00 +00:00
|
|
|
|
2018-10-27 06:22:42 +00:00
|
|
|
include::config/branch.txt[]
|
2013-01-01 09:30:53 +00:00
|
|
|
|
2018-10-27 06:22:43 +00:00
|
|
|
include::config/browser.txt[]
|
2008-01-29 06:08:22 +00:00
|
|
|
|
2022-10-12 12:52:30 +00:00
|
|
|
include::config/bundle.txt[]
|
|
|
|
|
2018-10-27 06:22:44 +00:00
|
|
|
include::config/checkout.txt[]
|
2018-08-16 18:27:11 +00:00
|
|
|
|
2018-10-27 06:22:45 +00:00
|
|
|
include::config/clean.txt[]
|
2007-04-24 00:18:16 +00:00
|
|
|
|
2020-10-01 03:46:16 +00:00
|
|
|
include::config/clone.txt[]
|
|
|
|
|
2018-10-27 06:22:46 +00:00
|
|
|
include::config/color.txt[]
|
2008-02-18 07:26:03 +00:00
|
|
|
|
2018-10-27 06:22:47 +00:00
|
|
|
include::config/column.txt[]
|
2012-04-13 10:54:41 +00:00
|
|
|
|
2018-10-27 06:22:48 +00:00
|
|
|
include::config/commit.txt[]
|
2016-05-05 09:50:02 +00:00
|
|
|
|
2020-09-09 15:23:10 +00:00
|
|
|
include::config/commitgraph.txt[]
|
|
|
|
|
2018-10-27 06:22:49 +00:00
|
|
|
include::config/credential.txt[]
|
2015-11-10 00:26:29 +00:00
|
|
|
|
2018-10-27 06:22:50 +00:00
|
|
|
include::config/completion.txt[]
|
2018-05-20 18:40:09 +00:00
|
|
|
|
2018-10-27 06:22:51 +00:00
|
|
|
include::config/diff.txt[]
|
2009-04-07 08:21:20 +00:00
|
|
|
|
2018-10-27 06:22:52 +00:00
|
|
|
include::config/difftool.txt[]
|
2009-04-07 08:21:22 +00:00
|
|
|
|
2020-07-29 23:14:27 +00:00
|
|
|
include::config/extensions.txt[]
|
|
|
|
|
2018-10-27 06:22:53 +00:00
|
|
|
include::config/fastimport.txt[]
|
2016-04-25 21:17:28 +00:00
|
|
|
|
2019-08-13 18:37:47 +00:00
|
|
|
include::config/feature.txt[]
|
|
|
|
|
2018-10-27 06:22:54 +00:00
|
|
|
include::config/fetch.txt[]
|
2018-07-16 18:44:01 +00:00
|
|
|
|
2018-10-27 06:22:56 +00:00
|
|
|
include::config/format.txt[]
|
2016-04-26 07:51:24 +00:00
|
|
|
|
2018-10-27 06:22:55 +00:00
|
|
|
include::config/filter.txt[]
|
2011-04-06 18:46:48 +00:00
|
|
|
|
2018-10-27 06:22:58 +00:00
|
|
|
include::config/fsck.txt[]
|
2015-06-22 15:27:23 +00:00
|
|
|
|
2022-10-04 17:32:31 +00:00
|
|
|
include::config/fsmonitor--daemon.txt[]
|
|
|
|
|
2018-10-27 06:22:59 +00:00
|
|
|
include::config/gc.txt[]
|
2006-12-27 09:24:05 +00:00
|
|
|
|
2018-10-27 06:23:00 +00:00
|
|
|
include::config/gitcvs.txt[]
|
2007-04-13 16:13:42 +00:00
|
|
|
|
2018-10-27 06:23:01 +00:00
|
|
|
include::config/gitweb.txt[]
|
2011-10-16 11:07:34 +00:00
|
|
|
|
2018-10-27 06:23:02 +00:00
|
|
|
include::config/grep.txt[]
|
2016-01-12 10:40:26 +00:00
|
|
|
|
2018-10-27 06:23:03 +00:00
|
|
|
include::config/gpg.txt[]
|
2018-07-17 12:50:11 +00:00
|
|
|
|
2018-10-27 06:23:04 +00:00
|
|
|
include::config/gui.txt[]
|
2008-11-13 17:28:49 +00:00
|
|
|
|
2018-10-27 06:23:05 +00:00
|
|
|
include::config/guitool.txt[]
|
2008-12-14 19:44:32 +00:00
|
|
|
|
2018-10-27 06:23:06 +00:00
|
|
|
include::config/help.txt[]
|
2013-01-15 20:56:21 +00:00
|
|
|
|
2018-10-27 06:23:08 +00:00
|
|
|
include::config/http.txt[]
|
2013-08-05 20:20:36 +00:00
|
|
|
|
2018-10-27 06:23:09 +00:00
|
|
|
include::config/i18n.txt[]
|
2006-12-28 00:41:33 +00:00
|
|
|
|
2018-10-27 06:23:10 +00:00
|
|
|
include::config/imap.txt[]
|
2008-11-26 08:26:50 +00:00
|
|
|
|
2022-07-16 20:13:43 +00:00
|
|
|
include::config/includeif.txt[]
|
|
|
|
|
2018-10-27 06:23:11 +00:00
|
|
|
include::config/index.txt[]
|
2014-02-23 20:49:59 +00:00
|
|
|
|
2018-10-27 06:23:12 +00:00
|
|
|
include::config/init.txt[]
|
2010-02-16 23:44:46 +00:00
|
|
|
|
2018-10-27 06:23:13 +00:00
|
|
|
include::config/instaweb.txt[]
|
2008-01-08 03:55:14 +00:00
|
|
|
|
2018-10-27 06:23:14 +00:00
|
|
|
include::config/interactive.txt[]
|
2016-02-27 05:37:06 +00:00
|
|
|
|
2018-10-27 06:23:15 +00:00
|
|
|
include::config/log.txt[]
|
2013-01-05 21:26:46 +00:00
|
|
|
|
ls-refs: report unborn targets of symrefs
When cloning, we choose the default branch based on the remote HEAD.
But if there is no remote HEAD reported (which could happen if the
target of the remote HEAD is unborn), we'll fall back to using our local
init.defaultBranch. Traditionally this hasn't been a big deal, because
most repos used "master" as the default. But these days it is likely to
cause confusion if the server and client implementations choose
different values (e.g., if the remote started with "main", we may choose
"master" locally, create commits there, and then the user is surprised
when they push to "master" and not "main").
To solve this, the remote needs to communicate the target of the HEAD
symref, even if it is unborn, and "git clone" needs to use this
information.
Currently, symrefs that have unborn targets (such as in this case) are
not communicated by the protocol. Teach Git to advertise and support the
"unborn" feature in "ls-refs" (by default, this is advertised, but
server administrators may turn this off through the lsrefs.unborn
config). This feature indicates that "ls-refs" supports the "unborn"
argument; when it is specified, "ls-refs" will send the HEAD symref with
the name of its unborn target.
This change is only for protocol v2. A similar change for protocol v0
would require independent protocol design (there being no analogous
position to signal support for "unborn") and client-side plumbing of the
data required, so the scope of this patch set is limited to protocol v2.
The client side will be updated to use this in a subsequent commit.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-05 20:48:47 +00:00
|
|
|
include::config/lsrefs.txt[]
|
|
|
|
|
2018-10-27 06:23:16 +00:00
|
|
|
include::config/mailinfo.txt[]
|
2015-02-20 19:32:20 +00:00
|
|
|
|
2018-10-27 06:23:17 +00:00
|
|
|
include::config/mailmap.txt[]
|
2012-12-12 11:04:04 +00:00
|
|
|
|
2020-09-17 18:11:49 +00:00
|
|
|
include::config/maintenance.txt[]
|
|
|
|
|
2018-10-27 06:23:18 +00:00
|
|
|
include::config/man.txt[]
|
2008-04-25 06:24:41 +00:00
|
|
|
|
2018-10-27 06:23:19 +00:00
|
|
|
include::config/merge.txt[]
|
2008-08-29 17:49:56 +00:00
|
|
|
|
2018-10-27 06:23:20 +00:00
|
|
|
include::config/mergetool.txt[]
|
2008-11-13 12:41:14 +00:00
|
|
|
|
2018-10-27 06:23:21 +00:00
|
|
|
include::config/notes.txt[]
|
2010-03-12 17:04:32 +00:00
|
|
|
|
2018-10-27 06:23:22 +00:00
|
|
|
include::config/pack.txt[]
|
pack-bitmap: implement optional name_hash cache
When we use pack bitmaps rather than walking the object
graph, we end up with the list of objects to include in the
packfile, but we do not know the path at which any tree or
blob objects would be found.
In a recently packed repository, this is fine. A fetch would
use the paths only as a heuristic in the delta compression
phase, and a fully packed repository should not need to do
much delta compression.
As time passes, though, we may acquire more objects on top
of our large bitmapped pack. If clients fetch frequently,
then they never even look at the bitmapped history, and all
works as usual. However, a client who has not fetched since
the last bitmap repack will have "have" tips in the
bitmapped history, but "want" newer objects.
The bitmaps themselves degrade gracefully in this
circumstance. We manually walk the more recent bits of
history, and then use bitmaps when we hit them.
But we would also like to perform delta compression between
the newer objects and the bitmapped objects (both to delta
against what we know the user already has, but also between
"new" and "old" objects that the user is fetching). The lack
of pathnames makes our delta heuristics much less effective.
This patch adds an optional cache of the 32-bit name_hash
values to the end of the bitmap file. If present, a reader
can use it to match bitmapped and non-bitmapped names during
delta compression.
Here are perf results for p5310:
Test origin/master HEAD^ HEAD
-------------------------------------------------------------------------------------------------
5310.2: repack to disk 36.81(37.82+1.43) 47.70(48.74+1.41) +29.6% 47.75(48.70+1.51) +29.7%
5310.3: simulated clone 30.78(29.70+2.14) 1.08(0.97+0.10) -96.5% 1.07(0.94+0.12) -96.5%
5310.4: simulated fetch 3.16(6.10+0.08) 3.54(10.65+0.06) +12.0% 1.70(3.07+0.06) -46.2%
5310.6: partial bitmap 36.76(43.19+1.81) 6.71(11.25+0.76) -81.7% 4.08(6.26+0.46) -88.9%
You can see that the time spent on an incremental fetch goes
down, as our delta heuristics are able to do their work.
And we save time on the partial bitmap clone for the same
reason.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-21 14:00:45 +00:00
|
|
|
|
2018-10-27 06:23:23 +00:00
|
|
|
include::config/pager.txt[]
|
2008-08-16 02:14:33 +00:00
|
|
|
|
2018-10-27 06:23:24 +00:00
|
|
|
include::config/pretty.txt[]
|
2010-05-02 11:00:44 +00:00
|
|
|
|
2018-10-27 06:23:25 +00:00
|
|
|
include::config/protocol.txt[]
|
2017-10-16 17:55:24 +00:00
|
|
|
|
2018-10-27 06:23:26 +00:00
|
|
|
include::config/pull.txt[]
|
2017-10-23 11:44:49 +00:00
|
|
|
|
2018-10-27 06:23:27 +00:00
|
|
|
include::config/push.txt[]
|
2015-11-17 11:05:56 +00:00
|
|
|
|
2018-10-27 06:23:28 +00:00
|
|
|
include::config/rebase.txt[]
|
2015-06-13 16:26:58 +00:00
|
|
|
|
2018-10-27 06:23:29 +00:00
|
|
|
include::config/receive.txt[]
|
2013-12-05 13:02:47 +00:00
|
|
|
|
2018-10-27 06:23:30 +00:00
|
|
|
include::config/remote.txt[]
|
2013-07-13 09:36:24 +00:00
|
|
|
|
2018-10-27 06:23:31 +00:00
|
|
|
include::config/remotes.txt[]
|
2007-02-20 20:13:43 +00:00
|
|
|
|
2018-10-27 06:23:32 +00:00
|
|
|
include::config/repack.txt[]
|
repack: add `repack.packKeptObjects` config var
The git-repack command always passes `--honor-pack-keep`
to pack-objects. This has traditionally been a good thing,
as we do not want to duplicate those objects in a new pack,
and we are not going to delete the old pack.
However, when bitmaps are in use, it is important for a full
repack to include all reachable objects, even if they may be
duplicated in a .keep pack. Otherwise, we cannot generate
the bitmaps, as the on-disk format requires the set of
objects in the pack to be fully closed.
Even if the repository does not generally have .keep files,
a simultaneous push could cause a race condition in which a
.keep file exists at the moment of a repack. The repack may
try to include those objects in one of two situations:
1. The pushed .keep pack contains objects that were
already in the repository (e.g., blobs due to a revert of
an old commit).
2. Receive-pack updates the refs, making the objects
reachable, but before it removes the .keep file, the
repack runs.
In either case, we may prefer to duplicate some objects in
the new, full pack, and let the next repack (after the .keep
file is cleaned up) take care of removing them.
This patch introduces both a command-line and config option
to disable the `--honor-pack-keep` option. By default, it
is triggered when pack.writeBitmaps (or `--write-bitmap-index`
is turned on), but specifying it explicitly can override the
behavior (e.g., in cases where you prefer .keep files to
bitmaps, but only when they are present).
Note that this option just disables the pack-objects
behavior. We still leave packs with a .keep in place, as we
do not necessarily know that we have duplicated all of their
objects.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-03 20:04:20 +00:00
|
|
|
|
2018-10-27 06:23:33 +00:00
|
|
|
include::config/rerere.txt[]
|
2008-11-26 08:26:50 +00:00
|
|
|
|
2022-06-26 09:29:35 +00:00
|
|
|
include::config/revert.txt[]
|
|
|
|
|
2022-03-02 11:23:04 +00:00
|
|
|
include::config/safe.txt[]
|
|
|
|
|
2018-10-27 06:23:35 +00:00
|
|
|
include::config/sendemail.txt[]
|
2017-05-21 12:59:50 +00:00
|
|
|
|
2018-10-27 06:23:36 +00:00
|
|
|
include::config/sequencer.txt[]
|
2018-08-22 16:06:04 +00:00
|
|
|
|
2018-10-27 06:23:37 +00:00
|
|
|
include::config/showbranch.txt[]
|
2006-04-24 22:59:33 +00:00
|
|
|
|
repo_read_index: add config to expect files outside sparse patterns
Typically with sparse checkouts, we expect files outside the sparsity
patterns to be marked as SKIP_WORKTREE and be missing from the working
tree. Sometimes this expectation would be violated however; including
in cases such as:
* users grabbing files from elsewhere and writing them to the worktree
(perhaps by editing a cached copy in an editor, copying/renaming, or
even untarring)
* various git commands having incomplete or no support for the
SKIP_WORKTREE bit[1,2]
* users attempting to "abort" a sparse-checkout operation with a
not-so-early Ctrl+C (updating $GIT_DIR/info/sparse-checkout and the
working tree is not atomic)[3].
When the SKIP_WORKTREE bit in the index did not reflect the presence of
the file in the working tree, it traditionally caused confusion and was
difficult to detect and recover from. So, in a sparse checkout, since
af6a51875a (repo_read_index: clear SKIP_WORKTREE bit from files present
in worktree, 2022-01-14), Git automatically clears the SKIP_WORKTREE
bit at index read time for entries corresponding to files that are
present in the working tree.
There is another workflow, however, where it is expected that paths
outside the sparsity patterns appear to exist in the working tree and
that they do not lose the SKIP_WORKTREE bit, at least until they get
modified. A Git-aware virtual file system[4] takes advantage of its
position as a file system driver to expose all files in the working
tree, fetch them on demand using partial clone on access, and tell Git
to pay attention to them on demand by updating the sparse checkout
pattern on writes. This means that commands like "git status" only have
to examine files that have potentially been modified, whereas commands
like "ls" are able to show the entire codebase without requiring manual
updates to the sparse checkout pattern.
Thus since af6a51875a, Git with such Git-aware virtual file systems
unsets the SKIP_WORKTREE bit for all files and commands like "git
status" have to fetch and examine them all.
Introduce a configuration setting sparse.expectFilesOutsideOfPatterns to
allow limiting the tracked set of files to a small set once again. A
Git-aware virtual file system or other application that wants to
maintain files outside of the sparse checkout can set this in a
repository to instruct Git not to check for the presence of
SKIP_WORKTREE files. The setting defaults to false, so most users of
sparse checkout will still get the benefit of an automatically updating
index to recover from the variety of difficult issues detailed in
af6a51875a for paths with SKIP_WORKTREE set despite the path being
present.
[1] https://lore.kernel.org/git/xmqqbmb1a7ga.fsf@gitster-ct.c.googlers.com/
[2] The three long paragraphs in the middle of
https://lore.kernel.org/git/CABPp-BH9tju7WVm=QZDOvaMDdZbpNXrVWQdN-jmfN8wC6YVhmw@mail.gmail.com/
[3] https://lore.kernel.org/git/CABPp-BFnFpzwGC11TLoLs8YK5yiisA5D5-fFjXnJsbESVDwZsA@mail.gmail.com/
[4] such as the vfsd described in
https://lore.kernel.org/git/20220207190320.2960362-1-jonathantanmy@google.com/
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-26 06:12:22 +00:00
|
|
|
include::config/sparse.txt[]
|
|
|
|
|
2018-10-27 06:23:38 +00:00
|
|
|
include::config/splitindex.txt[]
|
2017-03-06 09:42:02 +00:00
|
|
|
|
2018-10-27 06:23:07 +00:00
|
|
|
include::config/ssh.txt[]
|
|
|
|
|
2018-10-27 06:23:39 +00:00
|
|
|
include::config/status.txt[]
|
2010-05-20 15:55:42 +00:00
|
|
|
|
2018-10-27 06:23:40 +00:00
|
|
|
include::config/stash.txt[]
|
2015-08-29 15:25:57 +00:00
|
|
|
|
2018-10-27 06:23:41 +00:00
|
|
|
include::config/submodule.txt[]
|
2016-08-17 22:45:35 +00:00
|
|
|
|
2018-10-27 06:23:42 +00:00
|
|
|
include::config/tag.txt[]
|
2006-07-20 09:30:44 +00:00
|
|
|
|
2020-03-18 18:26:00 +00:00
|
|
|
include::config/tar.txt[]
|
|
|
|
|
2019-04-15 20:39:50 +00:00
|
|
|
include::config/trace2.txt[]
|
|
|
|
|
2018-10-27 06:23:43 +00:00
|
|
|
include::config/transfer.txt[]
|
2008-11-26 08:26:50 +00:00
|
|
|
|
2018-10-27 06:23:44 +00:00
|
|
|
include::config/uploadarchive.txt[]
|
add uploadarchive.allowUnreachable option
In commit ee27ca4, we started restricting remote git-archive
invocations to only accessing reachable commits. This
matches what upload-pack allows, but does restrict some
useful cases (e.g., HEAD:foo). We loosened this in 0f544ee,
which allows `foo:bar` as long as `foo` is a ref tip.
However, that still doesn't allow many useful things, like:
1. Commits accessible from a ref, like `foo^:bar`, which
are reachable
2. Arbitrary sha1s, even if they are reachable.
We can do a full object-reachability check for these cases,
but it can be quite expensive if the client has sent us the
sha1 of a tree; we have to visit every sub-tree of every
commit in the worst case.
Let's instead give site admins an escape hatch, in case they
prefer the more liberal behavior. For many sites, the full
object database is public anyway (e.g., if you allow dumb
walker access), or the site admin may simply decide the
security/convenience tradeoff is not worth it.
This patch adds a new config option to disable the
restrictions added in ee27ca4. It defaults to off, meaning
there is no change in behavior by default.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-02-28 10:04:19 +00:00
|
|
|
|
2018-10-27 06:23:45 +00:00
|
|
|
include::config/uploadpack.txt[]
|
2018-06-27 22:30:17 +00:00
|
|
|
|
2018-10-27 06:23:46 +00:00
|
|
|
include::config/url.txt[]
|
2009-09-07 08:56:33 +00:00
|
|
|
|
2018-10-27 06:23:47 +00:00
|
|
|
include::config/user.txt[]
|
2007-01-26 14:13:46 +00:00
|
|
|
|
2018-10-27 06:23:48 +00:00
|
|
|
include::config/versionsort.txt[]
|
2015-02-26 10:44:01 +00:00
|
|
|
|
2018-10-27 06:23:49 +00:00
|
|
|
include::config/web.txt[]
|
2017-11-29 20:04:51 +00:00
|
|
|
|
2018-10-27 06:23:50 +00:00
|
|
|
include::config/worktree.txt[]
|