]> git.ipfire.org Git - thirdparty/git.git/blobdiff - Documentation/config/core.txt
Merge branch 'ds/typofix-core-config-doc'
[thirdparty/git.git] / Documentation / config / core.txt
index c505388a070c119eef567d304f05fea7bc589fad..93d65e1dfd24f715e08d8a4d0bb71ca77fa6fde6 100644 (file)
@@ -62,11 +62,54 @@ core.protectNTFS::
        Defaults to `true` on Windows, and `false` elsewhere.
 
 core.fsmonitor::
-       If set, the value of this variable is used as a command which
-       will identify all files that may have changed since the
-       requested date/time. This information is used to speed up git by
-       avoiding unnecessary processing of files that have not changed.
-       See the "fsmonitor-watchman" section of linkgit:githooks[5].
+       If set to true, enable the built-in file system monitor
+       daemon for this working directory (linkgit:git-fsmonitor{litdd}daemon[1]).
++
+Like hook-based file system monitors, the built-in file system monitor
+can speed up Git commands that need to refresh the Git index
+(e.g. `git status`) in a working directory with many files.  The
+built-in monitor eliminates the need to install and maintain an
+external third-party tool.
++
+The built-in file system monitor is currently available only on a
+limited set of supported platforms.  Currently, this includes Windows
+and MacOS.
++
+       Otherwise, this variable contains the pathname of the "fsmonitor"
+       hook command.
++
+This hook command is used to identify all files that may have changed
+since the requested date/time. This information is used to speed up
+git by avoiding unnecessary scanning of files that have not changed.
++
+See the "fsmonitor-watchman" section of linkgit:githooks[5].
++
+Note that if you concurrently use multiple versions of Git, such
+as one version on the command line and another version in an IDE
+tool, that the definition of `core.fsmonitor` was extended to
+allow boolean values in addition to hook pathnames.  Git versions
+2.35.1 and prior will not understand the boolean values and will
+consider the "true" or "false" values as hook pathnames to be
+invoked.  Git versions 2.26 thru 2.35.1 default to hook protocol
+V2 and will fall back to no fsmonitor (full scan).  Git versions
+prior to 2.26 default to hook protocol V1 and will silently
+assume there were no changes to report (no scan), so status
+commands may report incomplete results.  For this reason, it is
+best to upgrade all of your Git versions before using the built-in
+file system monitor.
+
+core.fsmonitorHookVersion::
+       Sets the protocol version to be used when invoking the
+       "fsmonitor" hook.
++
+There are currently versions 1 and 2. When this is not set,
+version 2 will be tried first and if it fails then version 1
+will be tried. Version 1 uses a timestamp as input to determine
+which files have changes since that time but some monitors
+like Watchman have race conditions when used with a timestamp.
+Version 2 uses an opaque string so that the monitor can return
+something that can be used to determine what files have changed
+without race conditions.
 
 core.trustctime::
        If false, the ctime differences between the index and the
@@ -86,7 +129,9 @@ core.untrackedCache::
        it will automatically be removed, if set to `false`. Before
        setting it to `true`, you should check that mtime is working
        properly on your system.
-       See linkgit:git-update-index[1]. `keep` by default.
+       See linkgit:git-update-index[1]. `keep` by default, unless
+       `feature.manyFiles` is enabled which sets this setting to
+       `true` by default.
 
 core.checkStat::
        When missing or is set to `default`, many fields in the stat
@@ -121,11 +166,14 @@ core.quotePath::
 
 core.eol::
        Sets the line ending type to use in the working directory for
-       files that have the `text` property set when core.autocrlf is false.
+       files that are marked as text (either by having the `text`
+       attribute set, or by having `text=auto` and Git auto-detecting
+       the contents as text).
        Alternatives are 'lf', 'crlf' and 'native', which uses the platform's
        native line ending.  The default value is `native`.  See
        linkgit:gitattributes[5] for more information on end-of-line
-       conversion.
+       conversion. Note that this value is ignored if `core.autocrlf`
+       is set to `true` or `input`.
 
 core.safecrlf::
        If true, makes Git check if converting `CRLF` is reversible when
@@ -247,7 +295,7 @@ core.alternateRefsCommand::
        When advertising tips of available history from an alternate, use the shell to
        execute the specified command instead of linkgit:git-for-each-ref[1]. The
        first argument is the absolute path of the alternate. Output must contain one
-       hex object id per line (i.e., the same as produce by `git for-each-ref
+       hex object id per line (i.e., the same as produced by `git for-each-ref
        --format='%(objectname)'`).
 +
 Note that you cannot generally put `git for-each-ref` directly into the config
@@ -383,7 +431,7 @@ the largest projects.  You probably do not need to adjust this value.
 Common unit suffixes of 'k', 'm', or 'g' are supported.
 
 core.deltaBaseCacheLimit::
-       Maximum number of bytes to reserve for caching base objects
+       Maximum number of bytes per thread to reserve for caching base objects
        that may be referenced by multiple deltified objects.  By storing the
        entire decompressed base objects in a cache Git is able
        to avoid unpacking and decompressing frequently used base
@@ -396,22 +444,37 @@ You probably do not need to adjust this value.
 Common unit suffixes of 'k', 'm', or 'g' are supported.
 
 core.bigFileThreshold::
-       Files larger than this size are stored deflated, without
-       attempting delta compression.  Storing large files without
-       delta compression avoids excessive memory usage, at the
-       slight expense of increased disk usage. Additionally files
-       larger than this size are always treated as binary.
+       The size of files considered "big", which as discussed below
+       changes the behavior of numerous git commands, as well as how
+       such files are stored within the repository. The default is
+       512 MiB. Common unit suffixes of 'k', 'm', or 'g' are
+       supported.
 +
-Default is 512 MiB on all platforms.  This should be reasonable
-for most projects as source code and other text files can still
-be delta compressed, but larger binary media files won't be.
+Files above the configured limit will be:
 +
-Common unit suffixes of 'k', 'm', or 'g' are supported.
+* Stored deflated in packfiles, without attempting delta compression.
++
+The default limit is primarily set with this use-case in mind. With it,
+most projects will have their source code and other text files delta
+compressed, but not larger binary media files.
++
+Storing large files without delta compression avoids excessive memory
+usage, at the slight expense of increased disk usage.
++
+* Will be treated as if they were labeled "binary" (see
+  linkgit:gitattributes[5]). e.g. linkgit:git-log[1] and
+  linkgit:git-diff[1] will not compute diffs for files above this limit.
++
+* Will generally be streamed when written, which avoids excessive
+memory usage, at the cost of some fixed overhead. Commands that make
+use of this include linkgit:git-archive[1],
+linkgit:git-fast-import[1], linkgit:git-index-pack[1],
+linkgit:git-unpack-objects[1] and linkgit:git-fsck[1].
 
 core.excludesFile::
        Specifies the pathname to the file that contains patterns to
        describe paths that are not meant to be tracked, in addition
-       to '.gitignore' (per-directory) and '.git/info/exclude'.
+       to `.gitignore` (per-directory) and `.git/info/exclude`.
        Defaults to `$XDG_CONFIG_HOME/git/ignore`.
        If `$XDG_CONFIG_HOME` is either not set or empty, `$HOME/.config/git/ignore`
        is used instead. See linkgit:gitignore[5].
@@ -426,8 +489,8 @@ core.askPass::
        command-line argument and write the password on its STDOUT.
 
 core.attributesFile::
-       In addition to '.gitattributes' (per-directory) and
-       '.git/info/attributes', Git looks into this file for attributes
+       In addition to `.gitattributes` (per-directory) and
+       `.git/info/attributes`, Git looks into this file for attributes
        (see linkgit:gitattributes[5]). Path expansions are made the same
        way as for `core.excludesFile`. Its default value is
        `$XDG_CONFIG_HOME/git/attributes`. If `$XDG_CONFIG_HOME` is either not
@@ -435,10 +498,10 @@ core.attributesFile::
 
 core.hooksPath::
        By default Git will look for your hooks in the
-       '$GIT_DIR/hooks' directory. Set this to different path,
-       e.g. '/etc/git/hooks', and Git will try to find your hooks in
-       that directory, e.g. '/etc/git/hooks/pre-receive' instead of
-       in '$GIT_DIR/hooks/pre-receive'.
+       `$GIT_DIR/hooks` directory. Set this to different path,
+       e.g. `/etc/git/hooks`, and Git will try to find your hooks in
+       that directory, e.g. `/etc/git/hooks/pre-receive` instead of
+       in `$GIT_DIR/hooks/pre-receive`.
 +
 The path can be either absolute or relative. A relative path is
 taken as relative to the directory where the hooks are run (see
@@ -457,6 +520,7 @@ core.editor::
        `GIT_EDITOR` is not set.  See linkgit:git-var[1].
 
 core.commentChar::
+core.commentString::
        Commands such as `commit` and `tag` that let you edit
        messages consider a line that begins with this character
        commented, and removes them after the editor returns
@@ -464,6 +528,20 @@ core.commentChar::
 +
 If set to "auto", `git-commit` would select a character that is not
 the beginning character of any line in existing commit messages.
++
+Note that these two variables are aliases of each other, and in modern
+versions of Git you are free to use a string (e.g., `//` or `⁑⁕⁑`) with
+`commentChar`. Versions of Git prior to v2.45.0 will ignore
+`commentString` but will reject a value of `commentChar` that consists
+of more than a single ASCII byte. If you plan to use your config with
+older and newer versions of Git, you may want to specify both:
++
+    [core]
+    # single character for older versions
+    commentChar = "#"
+    # string for newer versions (which will override commentChar
+    # because it comes later in the file)
+    commentString = "//"
 
 core.filesRefLockTimeout::
        The length of time, in milliseconds, to retry when trying to
@@ -531,13 +609,72 @@ core.whitespace::
   is relevant for `indent-with-non-tab` and when Git fixes `tab-in-indent`
   errors. The default tab width is 8. Allowed values are 1 to 63.
 
+core.fsync::
+       A comma-separated list of components of the repository that
+       should be hardened via the core.fsyncMethod when created or
+       modified.  You can disable hardening of any component by
+       prefixing it with a '-'.  Items that are not hardened may be
+       lost in the event of an unclean system shutdown. Unless you
+       have special requirements, it is recommended that you leave
+       this option empty or pick one of `committed`, `added`,
+       or `all`.
++
+When this configuration is encountered, the set of components starts with
+the platform default value, disabled components are removed, and additional
+components are added. `none` resets the state so that the platform default
+is ignored.
++
+The empty string resets the fsync configuration to the platform
+default. The default on most platforms is equivalent to
+`core.fsync=committed,-loose-object`, which has good performance,
+but risks losing recent work in the event of an unclean system shutdown.
++
+* `none` clears the set of fsynced components.
+* `loose-object` hardens objects added to the repo in loose-object form.
+* `pack` hardens objects added to the repo in packfile form.
+* `pack-metadata` hardens packfile bitmaps and indexes.
+* `commit-graph` hardens the commit-graph file.
+* `index` hardens the index when it is modified.
+* `objects` is an aggregate option that is equivalent to
+  `loose-object,pack`.
+* `reference` hardens references modified in the repo.
+* `derived-metadata` is an aggregate option that is equivalent to
+  `pack-metadata,commit-graph`.
+* `committed` is an aggregate option that is currently equivalent to
+  `objects`. This mode sacrifices some performance to ensure that work
+  that is committed to the repository with `git commit` or similar commands
+  is hardened.
+* `added` is an aggregate option that is currently equivalent to
+  `committed,index`. This mode sacrifices additional performance to
+  ensure that the results of commands like `git add` and similar operations
+  are hardened.
+* `all` is an aggregate option that syncs all individual components above.
+
+core.fsyncMethod::
+       A value indicating the strategy Git will use to harden repository data
+       using fsync and related primitives.
++
+* `fsync` uses the fsync() system call or platform equivalents.
+* `writeout-only` issues pagecache writeback requests, but depending on the
+  filesystem and storage hardware, data added to the repository may not be
+  durable in the event of a system crash. This is the default mode on macOS.
+* `batch` enables a mode that uses writeout-only flushes to stage multiple
+  updates in the disk writeback cache and then does a single full fsync of
+  a dummy file to trigger the disk cache flush at the end of the operation.
++
+Currently `batch` mode only applies to loose-object files. Other repository
+data is made durable as if `fsync` was specified. This mode is expected to
+be as safe as `fsync` on macOS for repos stored on HFS+ or APFS filesystems
+and on Windows for repos stored on NTFS or ReFS filesystems.
+
 core.fsyncObjectFiles::
        This boolean will enable 'fsync()' when writing object files.
+       This setting is deprecated. Use core.fsync instead.
 +
-This is a total waste of time and effort on a filesystem that orders
-data writes properly, but can be useful for filesystems that do not use
-journalling (traditional UNIX filesystems) or that only journal metadata
-and not file contents (OS X's HFS+, or Linux ext3 with "data=writeback").
+This setting affects data added to the Git repository in loose-object
+form. When set to true, Git will issue an fsync or similar system call
+to flush caches so that loose-objects remain consistent in the face
+of a unclean system shutdown.
 
 core.preloadIndex::
        Enable parallel index preload for operations like 'git diff'
@@ -548,6 +685,18 @@ relatively high IO latencies.  When enabled, Git will do the
 index comparison to the filesystem data in parallel, allowing
 overlapping IO's.  Defaults to true.
 
+core.unsetenvvars::
+       Windows-only: comma-separated list of environment variables'
+       names that need to be unset before spawning any other process.
+       Defaults to `PERL5LIB` to account for the fact that Git for
+       Windows insists on using its own Perl interpreter.
+
+core.restrictinheritedhandles::
+       Windows-only: override whether spawned processes inherit only standard
+       file handles (`stdin`, `stdout` and `stderr`) or all handles. Can be
+       `auto`, `true` or `false`. Defaults to `auto`, which means `true` on
+       Windows 7 and later, and `false` on older Windows versions.
+
 core.createObject::
        You can set this to 'link', in which case a hardlink followed by
        a delete of the source are used to make sure that object creation
@@ -568,7 +717,7 @@ the `GIT_NOTES_REF` environment variable.  See linkgit:git-notes[1].
 
 core.commitGraph::
        If true, then git will read the commit-graph file (if it exists)
-       to parse the graph structure of commits. Defaults to false. See
+       to parse the graph structure of commits. Defaults to true. See
        linkgit:git-commit-graph[1] for more information.
 
 core.useReplaceRefs::
@@ -578,12 +727,20 @@ core.useReplaceRefs::
 
 core.multiPackIndex::
        Use the multi-pack-index file to track multiple packfiles using a
-       single index. See link:technical/multi-pack-index.html[the
-       multi-pack-index design document].
+       single index. See linkgit:git-multi-pack-index[1] for more
+       information. Defaults to true.
 
 core.sparseCheckout::
-       Enable "sparse checkout" feature. See section "Sparse checkout" in
-       linkgit:git-read-tree[1] for more information.
+       Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
+       for more information.
+
+core.sparseCheckoutCone::
+       Enables the "cone mode" of the sparse checkout feature. When the
+       sparse-checkout file contains a limited set of patterns, this
+       mode provides significant performance advantages. The "non-cone
+       mode" can be requested to allow specifying more flexible
+       patterns by setting this variable to 'false'. See
+       linkgit:git-sparse-checkout[1] for more information.
 
 core.abbrev::
        Set the length object names are abbreviated to.  If
@@ -591,4 +748,12 @@ core.abbrev::
        computed based on the approximate number of packed objects
        in your repository, which hopefully is enough for
        abbreviated object names to stay unique for some time.
+       If set to "no", no abbreviation is made and the object names
+       are shown in their full length.
        The minimum length is 4.
+
+core.maxTreeDepth::
+       The maximum depth Git is willing to recurse while traversing a
+       tree (e.g., "a/b/cde/f" has a depth of 4). This is a fail-safe
+       to allow Git to abort cleanly, and should not generally need to
+       be adjusted. The default is 4096.