Volume XXII, number 280Wednesday, October 7, 2026Latest message 58 minutes ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

patchdir: use per-worktree repository ignore patterns upon request

10 messages between Apr 24, 2026 and May 13, 2026, from D. Ben Knoble, brian m. carlson, Phillip Wood, Junio C Hamano.

Plain Markdown or JSON for tools and agents. Diffs are folded; open one to read it.

D. Ben KnobleApr 24, 2026, 17:09 UTC on lore

Today we have $GIT_DIR/info/exclude for the main worktree, but $(git rev-parse --git-dir)/info/exclude for secondary worktrees does not actually contribute to ignore specs; instead, secondary worktrees also use $GIT_COMMON_DIR/info/exclude.

Some users may prefer each worktree use its own ignore file; some may prefer both; some may prefer the current behavior.

Add, test, and document extensions.worktreeIgnore that controls which set of ignore files to use for worktrees.

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
Notes (benknoble/commits):
    Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
    This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean' into
    next, 2026-04-23)) but cleanly applies to master (94f057755b (Git 2.54,
    2026-04-19)) and seen (50541634cb (Merge branch
    'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
 Documentation/config/extensions.adoc |  7 ++++
 Documentation/git-worktree.adoc      |  3 ++
 Documentation/gitignore.adoc         |  6 ++--
 dir.c                                | 48 +++++++++++++++++++++++---
 t/meson.build                        |  1 +
 t/t2408-worktree-ignore.sh           | 50 ++++++++++++++++++++++++++++
 6 files changed, 109 insertions(+), 6 deletions(-)
 create mode 100755 t/t2408-worktree-ignore.sh
Show changes to 6 files +109 −6

Documentation/config/extensions.adoc, Documentation/git-worktree.adoc, Documentation/gitignore.adoc, dir.c, t/meson.build, t/t2408-worktree-ignore.sh

diff --git a/Documentation/config/extensions.adoc b/Documentation/config/extensions.adoc
index be6678bb5b..5bfb06a54b 100644
--- a/Documentation/config/extensions.adoc
+++ b/Documentation/config/extensions.adoc
@@ -148,3 +148,10 @@ details.
 +
 For historical reasons, this extension is respected regardless of the
 `core.repositoryFormatVersion` setting.
+
+worktreeIgnore:::
+	If enabled, then worktrees will load per-repository ignore files from
+	`$GIT_DIR/info/exclude` (that is,
+	`$GIT_COMMON_DIR/worktrees/<id>/info/exclude`). If set to `merge`, then
+	both `$GIT_COMMON_DIR/info/exclude` and `$GIT_DIR/info/exclude` are
+	used.
diff --git a/Documentation/git-worktree.adoc b/Documentation/git-worktree.adoc
index fbf8426cd9..611c1e06b0 100644
--- a/Documentation/git-worktree.adoc
+++ b/Documentation/git-worktree.adoc
@@ -412,6 +412,9 @@ 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.
 
+See `extensions.worktreeIgnore` in linkgit:git-config[1] to control how
+per-repository ignore files are found in worktrees.
+
 LIST OUTPUT FORMAT
 ------------------
 The `worktree list` command has two output formats. The default format shows the
diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
index a3d24e5c34..d6976a44e4 100644
--- a/Documentation/gitignore.adoc
+++ b/Documentation/gitignore.adoc
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
 
 SYNOPSIS
 --------
-$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
+$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
 
 DESCRIPTION
 -----------
@@ -34,7 +34,9 @@ precedence, the last matching pattern decides the outcome):
    includes such `.gitignore` files in its repository, containing patterns for
    files generated as part of the project build.
 
- * Patterns read from `$GIT_DIR/info/exclude`.
+ * Patterns read from `$GIT_COMMON_DIR/info/exclude`. (See
+   `extensions.worktreeIgnore` in linkgit:git-config[1] to change how this
+   applies to worktrees.)
 
  * Patterns read from the file specified by the configuration
    variable `core.excludesFile`.
diff --git a/dir.c b/dir.c
index fcb8f6dd2a..9592eb0062 100644
--- a/dir.c
+++ b/dir.c
@@ -36,6 +36,7 @@
 #include "trace2.h"
 #include "tree.h"
 #include "hex.h"
+#include "worktree.h"
 
  /*
   * The maximum size of a pattern/exclude file. If the file exceeds this size
@@ -3478,6 +3479,23 @@ int remove_dir_recursively(struct strbuf *path, int flag)
 }
 
 static GIT_PATH_FUNC(git_path_info_exclude, "info/exclude")
+static const char *git_worktree_info_exclude(void)
+{
+	static const char *ret;
+	if (!ret)
+	{
+		const struct worktree *wt = get_worktree_from_repository(the_repository);
+		ret = worktree_git_path(wt, "info/exclude");
+	}
+	return ret;
+}
+
+static void standard_exclude_from_info(const char *path, struct dir_struct *dir)
+{
+	struct oid_stat *oid_stat = dir->untracked ? &dir->internal.ss_info_exclude : NULL;
+	if (!access_or_warn(path, R_OK, 0))
+		add_patterns_from_file_1(dir, path, oid_stat);
+}
 
 void setup_standard_excludes(struct dir_struct *dir)
 {
@@ -3492,10 +3510,32 @@ void setup_standard_excludes(struct dir_struct *dir)
 
 	/* per repository user preference */
 	if (startup_info->have_repository) {
-		const char *path = git_path_info_exclude();
-		if (!access_or_warn(path, R_OK, 0))
-			add_patterns_from_file_1(dir, path,
-						 dir->untracked ? &dir->internal.ss_info_exclude : NULL);
+		/* extensions.worktreeIgnore determines which includes we add */
+		const char *wt_ignore;
+		int do_wt_ignore;
+		if (repo_config_get_value(the_repository,
+					  "extensions.worktreeIgnore",
+					  &wt_ignore)) {
+			/* unset: use main/.git/info/exclude */
+			standard_exclude_from_info(git_path_info_exclude(), dir);
+			return;
+		}
+		do_wt_ignore = git_parse_maybe_bool(wt_ignore);
+		if (!do_wt_ignore) {
+			/* false: as above */
+			standard_exclude_from_info(git_path_info_exclude(), dir);
+		} else if (do_wt_ignore > 0 || !strcmp(wt_ignore, "worktree")) {
+			/* true/worktree: use worktree/.git‡/info/exclude
+			 * ‡: resolving .git */
+			standard_exclude_from_info(git_worktree_info_exclude(), dir);
+		} else if (!strcmp(wt_ignore, "merge")) {
+			/* merge both! worktree last */
+			standard_exclude_from_info(git_path_info_exclude(), dir);
+			standard_exclude_from_info(git_worktree_info_exclude(), dir);
+		} else {
+			die(_("invalid value for '%s': '%s'"),
+			      "extensions.worktreeIgnore", wt_ignore);
+		}
 	}
 }
 
diff --git a/t/meson.build b/t/meson.build
index 7528e5cda5..30624b59e8 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -307,6 +307,7 @@ integration_tests = [
   't2405-worktree-submodule.sh',
   't2406-worktree-repair.sh',
   't2407-worktree-heads.sh',
+  't2408-worktree-ignore.sh',
   't2500-untracked-overwriting.sh',
   't2501-cwd-empty.sh',
   't3000-ls-files-others.sh',
diff --git a/t/t2408-worktree-ignore.sh b/t/t2408-worktree-ignore.sh
new file mode 100755
index 0000000000..67644ddd8d
--- /dev/null
+++ b/t/t2408-worktree-ignore.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+test_description='extensions.worktreeIgnore'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	test_commit init &&
+	git worktree add wt &&
+	echo main >.git/info/exclude &&
+	echo contents >main &&
+	echo contents >wt/main &&
+	wt_exclude="$(git -C wt rev-parse --git-dir)"/info/exclude &&
+	mkdir -p "$(dirname "$wt_exclude")" &&
+	echo worktree >"$wt_exclude" &&
+	echo contents >worktree &&
+	echo contents >wt/worktree
+'
+
+test_ignore_main() {
+	git check-ignore main &&
+	git -C wt check-ignore main
+}
+
+test_expect_success 'ignores main items by default' '
+	test_ignore_main
+'
+
+test_expect_success 'ignores main items with extensions.worktreeIgnore=no' '
+	test_config extensions.worktreeIgnore no &&
+	test_ignore_main
+'
+
+test_expect_success 'ignores worktree items with extensions.worktreeIgnore=worktree' '
+	test_config extensions.worktreeIgnore worktree &&
+	git check-ignore main &&
+	! git check-ignore worktree &&
+	! git -C wt check-ignore main &&
+	git -C wt check-ignore worktree
+'
+
+test_expect_success 'ignores all items with extensions.worktreeIgnore=merge' '
+	test_config extensions.worktreeIgnore merge &&
+	git check-ignore main &&
+	! git check-ignore worktree &&
+	git -C wt check-ignore main &&
+	git -C wt check-ignore worktree
+'
+
+test_done

base-commit: 4f69b47b940100b02630f745a52f9d9850f122b2
-- 
2.54.0.rc2.544.gc7ae2d5bb8.dirty
brian m. carlsonApr 24, 2026, 19:35 UTC in reply to D. Ben Knoble on lore

Re: [PATCH] dir: use per-worktree repository ignore patterns upon request

On 2026-04-24 at 17:09:19, D. Ben Knoble wrote:
Show 10 quoted lines
> Today we have $GIT_DIR/info/exclude for the main worktree, but $(git
> rev-parse --git-dir)/info/exclude for secondary worktrees does not
> actually contribute to ignore specs; instead, secondary worktrees also
> use $GIT_COMMON_DIR/info/exclude.
> 
> Some users may prefer each worktree use its own ignore file; some may
> prefer both; some may prefer the current behavior.
> 
> Add, test, and document extensions.worktreeIgnore that controls which
> set of ignore files to use for worktrees.

I was wondering if we could make something like `extensions.worktreeInfoFiles` or something and also make the `info/attributes` (and maybe `info/sparse-checkout`) file used instead. I think that would be somewhat better than having additional options added on after the fact and be a little more generally applicable.

What do you think? My apologies for not mentioning this sooner before you'd already sent a patch.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Phillip WoodApr 24, 2026, 19:53 UTC in reply to D. Ben Knoble on lore

Re: [PATCH] dir: use per-worktree repository ignore patterns upon request

Hi Ben
On 24/04/2026 18:09, D. Ben Knoble wrote:
> Today we have $GIT_DIR/info/exclude for the main worktree, but $(git
> rev-parse --git-dir)/info/exclude for secondary worktrees does not
> actually contribute to ignore specs; instead, secondary worktrees also
> use $GIT_COMMON_DIR/info/exclude.

Sharing the same set of exclude patterns between all worktrees seems like a reasonable thing to do - it would be a pain to have to populate them every time a new worktree was created.

	git rev-parse --git-path info/exclude

always returns the correct path because it uses repo_git_path() which knows whether a particular path is per-worktree or resides under $GIT_COMMON_DIR. It is best to avoid constructing paths manually using "git rev-parse --git-dir"

> Some users may prefer each worktree use its own ignore file; some may
> prefer both; some may prefer the current behavior.

This sounds quite hypothetical - do we have a concrete use case for per-worktree exclude files?

If there is a use for per-worktree excludes it would be much better to use a different path such as "info.worktree/exclude" so that the main worktree can have both shared and per-worktree excludes. We could use "exclude.worktree" like "config.worktree" but then we'd be in danger of adding new ".worktree" files in the future if we want to add per-worktree versions of other files that live under "info/"

Thanks
Phillip
Show 219 quoted lines
> Add, test, and document extensions.worktreeIgnore that controls which
> set of ignore files to use for worktrees.
> 
> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
> ---
> 
> Notes (benknoble/commits):
>      Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
> 
>      This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean' into
>      next, 2026-04-23)) but cleanly applies to master (94f057755b (Git 2.54,
>      2026-04-19)) and seen (50541634cb (Merge branch
>      'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
> 
>   Documentation/config/extensions.adoc |  7 ++++
>   Documentation/git-worktree.adoc      |  3 ++
>   Documentation/gitignore.adoc         |  6 ++--
>   dir.c                                | 48 +++++++++++++++++++++++---
>   t/meson.build                        |  1 +
>   t/t2408-worktree-ignore.sh           | 50 ++++++++++++++++++++++++++++
>   6 files changed, 109 insertions(+), 6 deletions(-)
>   create mode 100755 t/t2408-worktree-ignore.sh
> 
> diff --git a/Documentation/config/extensions.adoc b/Documentation/config/extensions.adoc
> index be6678bb5b..5bfb06a54b 100644
> --- a/Documentation/config/extensions.adoc
> +++ b/Documentation/config/extensions.adoc
> @@ -148,3 +148,10 @@ details.
>   +
>   For historical reasons, this extension is respected regardless of the
>   `core.repositoryFormatVersion` setting.
> +
> +worktreeIgnore:::
> +	If enabled, then worktrees will load per-repository ignore files from
> +	`$GIT_DIR/info/exclude` (that is,
> +	`$GIT_COMMON_DIR/worktrees/<id>/info/exclude`). If set to `merge`, then
> +	both `$GIT_COMMON_DIR/info/exclude` and `$GIT_DIR/info/exclude` are
> +	used.
> diff --git a/Documentation/git-worktree.adoc b/Documentation/git-worktree.adoc
> index fbf8426cd9..611c1e06b0 100644
> --- a/Documentation/git-worktree.adoc
> +++ b/Documentation/git-worktree.adoc
> @@ -412,6 +412,9 @@ 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.
>   
> +See `extensions.worktreeIgnore` in linkgit:git-config[1] to control how
> +per-repository ignore files are found in worktrees.
> +
>   LIST OUTPUT FORMAT
>   ------------------
>   The `worktree list` command has two output formats. The default format shows the
> diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
> index a3d24e5c34..d6976a44e4 100644
> --- a/Documentation/gitignore.adoc
> +++ b/Documentation/gitignore.adoc
> @@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
>   
>   SYNOPSIS
>   --------
> -$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
> +$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
>   
>   DESCRIPTION
>   -----------
> @@ -34,7 +34,9 @@ precedence, the last matching pattern decides the outcome):
>      includes such `.gitignore` files in its repository, containing patterns for
>      files generated as part of the project build.
>   
> - * Patterns read from `$GIT_DIR/info/exclude`.
> + * Patterns read from `$GIT_COMMON_DIR/info/exclude`. (See
> +   `extensions.worktreeIgnore` in linkgit:git-config[1] to change how this
> +   applies to worktrees.)
>   
>    * Patterns read from the file specified by the configuration
>      variable `core.excludesFile`.
> diff --git a/dir.c b/dir.c
> index fcb8f6dd2a..9592eb0062 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -36,6 +36,7 @@
>   #include "trace2.h"
>   #include "tree.h"
>   #include "hex.h"
> +#include "worktree.h"
>   
>    /*
>     * The maximum size of a pattern/exclude file. If the file exceeds this size
> @@ -3478,6 +3479,23 @@ int remove_dir_recursively(struct strbuf *path, int flag)
>   }
>   
>   static GIT_PATH_FUNC(git_path_info_exclude, "info/exclude")
> +static const char *git_worktree_info_exclude(void)
> +{
> +	static const char *ret;
> +	if (!ret)
> +	{
> +		const struct worktree *wt = get_worktree_from_repository(the_repository);
> +		ret = worktree_git_path(wt, "info/exclude");
> +	}
> +	return ret;
> +}
> +
> +static void standard_exclude_from_info(const char *path, struct dir_struct *dir)
> +{
> +	struct oid_stat *oid_stat = dir->untracked ? &dir->internal.ss_info_exclude : NULL;
> +	if (!access_or_warn(path, R_OK, 0))
> +		add_patterns_from_file_1(dir, path, oid_stat);
> +}
>   
>   void setup_standard_excludes(struct dir_struct *dir)
>   {
> @@ -3492,10 +3510,32 @@ void setup_standard_excludes(struct dir_struct *dir)
>   
>   	/* per repository user preference */
>   	if (startup_info->have_repository) {
> -		const char *path = git_path_info_exclude();
> -		if (!access_or_warn(path, R_OK, 0))
> -			add_patterns_from_file_1(dir, path,
> -						 dir->untracked ? &dir->internal.ss_info_exclude : NULL);
> +		/* extensions.worktreeIgnore determines which includes we add */
> +		const char *wt_ignore;
> +		int do_wt_ignore;
> +		if (repo_config_get_value(the_repository,
> +					  "extensions.worktreeIgnore",
> +					  &wt_ignore)) {
> +			/* unset: use main/.git/info/exclude */
> +			standard_exclude_from_info(git_path_info_exclude(), dir);
> +			return;
> +		}
> +		do_wt_ignore = git_parse_maybe_bool(wt_ignore);
> +		if (!do_wt_ignore) {
> +			/* false: as above */
> +			standard_exclude_from_info(git_path_info_exclude(), dir);
> +		} else if (do_wt_ignore > 0 || !strcmp(wt_ignore, "worktree")) {
> +			/* true/worktree: use worktree/.git‡/info/exclude
> +			 * ‡: resolving .git */
> +			standard_exclude_from_info(git_worktree_info_exclude(), dir);
> +		} else if (!strcmp(wt_ignore, "merge")) {
> +			/* merge both! worktree last */
> +			standard_exclude_from_info(git_path_info_exclude(), dir);
> +			standard_exclude_from_info(git_worktree_info_exclude(), dir);
> +		} else {
> +			die(_("invalid value for '%s': '%s'"),
> +			      "extensions.worktreeIgnore", wt_ignore);
> +		}
>   	}
>   }
>   
> diff --git a/t/meson.build b/t/meson.build
> index 7528e5cda5..30624b59e8 100644
> --- a/t/meson.build
> +++ b/t/meson.build
> @@ -307,6 +307,7 @@ integration_tests = [
>     't2405-worktree-submodule.sh',
>     't2406-worktree-repair.sh',
>     't2407-worktree-heads.sh',
> +  't2408-worktree-ignore.sh',
>     't2500-untracked-overwriting.sh',
>     't2501-cwd-empty.sh',
>     't3000-ls-files-others.sh',
> diff --git a/t/t2408-worktree-ignore.sh b/t/t2408-worktree-ignore.sh
> new file mode 100755
> index 0000000000..67644ddd8d
> --- /dev/null
> +++ b/t/t2408-worktree-ignore.sh
> @@ -0,0 +1,50 @@
> +#!/bin/sh
> +
> +test_description='extensions.worktreeIgnore'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'setup' '
> +	test_commit init &&
> +	git worktree add wt &&
> +	echo main >.git/info/exclude &&
> +	echo contents >main &&
> +	echo contents >wt/main &&
> +	wt_exclude="$(git -C wt rev-parse --git-dir)"/info/exclude &&
> +	mkdir -p "$(dirname "$wt_exclude")" &&
> +	echo worktree >"$wt_exclude" &&
> +	echo contents >worktree &&
> +	echo contents >wt/worktree
> +'
> +
> +test_ignore_main() {
> +	git check-ignore main &&
> +	git -C wt check-ignore main
> +}
> +
> +test_expect_success 'ignores main items by default' '
> +	test_ignore_main
> +'
> +
> +test_expect_success 'ignores main items with extensions.worktreeIgnore=no' '
> +	test_config extensions.worktreeIgnore no &&
> +	test_ignore_main
> +'
> +
> +test_expect_success 'ignores worktree items with extensions.worktreeIgnore=worktree' '
> +	test_config extensions.worktreeIgnore worktree &&
> +	git check-ignore main &&
> +	! git check-ignore worktree &&
> +	! git -C wt check-ignore main &&
> +	git -C wt check-ignore worktree
> +'
> +
> +test_expect_success 'ignores all items with extensions.worktreeIgnore=merge' '
> +	test_config extensions.worktreeIgnore merge &&
> +	git check-ignore main &&
> +	! git check-ignore worktree &&
> +	git -C wt check-ignore main &&
> +	git -C wt check-ignore worktree
> +'
> +
> +test_done
> 
> base-commit: 4f69b47b940100b02630f745a52f9d9850f122b2
Junio C HamanoApr 25, 2026, 03:06 UTC in reply to Phillip Wood on lore

Re: [PATCH] dir: use per-worktree repository ignore patterns upon request

Phillip Wood <phillip.wood123@gmail.com> writes:
Show 10 quoted lines
> Sharing the same set of exclude patterns between all worktrees seems 
> like a reasonable thing to do - it would be a pain to have to populate 
> them every time a new worktree was created.
>
> 	git rev-parse --git-path info/exclude
>
> always returns the correct path because it uses repo_git_path() which 
> knows whether a particular path is per-worktree or resides under 
> $GIT_COMMON_DIR. It is best to avoid constructing paths manually using 
> "git rev-parse --git-dir"
Great to see the best practice raised, like this.
Show 5 quoted lines
>> Some users may prefer each worktree use its own ignore file; some may
>> prefer both; some may prefer the current behavior.
>
> This sounds quite hypothetical - do we have a concrete use case for 
> per-worktree exclude files?

I can see if somebody wants to have different subset of paths checked out by setting up separate sparse settings. But marking what paths are never be part of the project (which is what exclude is about)? I do not think it is useful in general.

The only case I can think of is a repository that houses more than one completely unrelated histories, perhaps being cheapster on a hosting site that charges per number of repositories or something silly like that.

My https://git.kernel.org/pub/scm/git/git.git/ repository houses two completely unrelated histories, one the project data, and 'todo' that are mostly about tools I personally use to maintain the project. Ideally, the latter branch should have been created and maintained as a separate repository, but back them I didn't have write access outside pub/scm/git/git.git/ (notably pub/scm/git/ itself was not writable to me) and that was the only reason why that unrelated history is pushed into the same repository as a separate and unrelated 'todo' branch. It is not a recommended practice, and if this configuration is primarily to cater to such layout, I do not think we want to add it.

D. Ben KnobleMay 8, 2026, 14:14 UTC in reply to D. Ben Knoble on lore

[PATCH v2] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR

gitignore(5) says that the per-repository ignore file is $GIT_DIR/info/exclude, but in a worktree that is not the case:

    git rev-parse --git-path info/exclude
    /path/to/main/worktree/.git/info/exclude
    git rev-parse --git-common-dir
    /path/to/main/worktree/.git

We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation to say so.

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
Notes (benknoble/commits):
    Changes in v2:
    
    Only adjust the documentation.
    
    brian points out that a more general extension would allow using more
    info/ files as "per-worktree," which I don't have the impetus to
    implement myself.
    
    Phillip and Junio asked for a concrete use case:
    
        A colleague is developing a tool for managing the "skill files" of
        various LLM tools (Claude, Windsurf, etc.). The files have
        requirements that make it hard to generically ignore them (e.g.,
        filenames and front-matter have to match), but different tasks
        (corresponding to worktrees) may want different active skills, so it
        is desirable to ignore the files. Think of this like node_modules.
    
        Unfortunately, since per-worktree ignores don't work, the current
        solution is to put a .gitignore file in the corresponding directory
        with the installed skills that ignores itself and the installed
        skills.
    
    Since overall reactions seem fairly negative (or require a more general
    extension, which I think is probably the right course but not simply
    implemented), I've opted to adjust the docs. They originally confused
    me, as I was surprised when my colleague reported that per-worktree
    ignores didn't work (the docs imply they should by use of $GIT_DIR).
    
    Link to v1: <e3ee0a11b566dd2cc605447c111ae4620bce0fe6.1777050300.git.ben.knoble+github@gmail.com>
    
    v1 notes:
    
    Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
    
    This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean'
    into next, 2026-04-23)) but cleanly applies to master (94f057755b (Git
    2.54, 2026-04-19)) and seen (50541634cb (Merge branch
    'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
 Documentation/gitignore.adoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to Documentation/gitignore.adoc +2 −2
diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
index a3d24e5c34..c423b650de 100644
--- a/Documentation/gitignore.adoc
+++ b/Documentation/gitignore.adoc
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
 
 SYNOPSIS
 --------
-$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
+$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
 
 DESCRIPTION
 -----------
@@ -34,7 +34,7 @@ precedence, the last matching pattern decides the outcome):
    includes such `.gitignore` files in its repository, containing patterns for
    files generated as part of the project build.
 
- * Patterns read from `$GIT_DIR/info/exclude`.
+ * Patterns read from `$GIT_COMMON_DIR/info/exclude`.
 
  * Patterns read from the file specified by the configuration
    variable `core.excludesFile`.

base-commit: 4f69b47b940100b02630f745a52f9d9850f122b2
-- 
2.54.0.564.ge3ee0a11b5.dirty
brian m. carlsonMay 9, 2026, 14:08 UTC in reply to D. Ben Knoble on lore

Re: [PATCH v2] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR

On 2026-05-08 at 14:14:14, D. Ben Knoble wrote:
Show 10 quoted lines
> gitignore(5) says that the per-repository ignore file is
> $GIT_DIR/info/exclude, but in a worktree that is not the case:
> 
>     git rev-parse --git-path info/exclude
>     /path/to/main/worktree/.git/info/exclude
>     git rev-parse --git-common-dir
>     /path/to/main/worktree/.git
> 
> We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation
> to say so.

This seems quite reasonable. I always appreciate documentation patches that clarify things or fix inaccuracies.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Phillip WoodMay 11, 2026, 10:30 UTC in reply to D. Ben Knoble on lore

Re: [PATCH v2] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR

On 08/05/2026 15:14, D. Ben Knoble wrote:
Show 10 quoted lines
> gitignore(5) says that the per-repository ignore file is
> $GIT_DIR/info/exclude, but in a worktree that is not the case:
> 
>      git rev-parse --git-path info/exclude
>      /path/to/main/worktree/.git/info/exclude
>      git rev-parse --git-common-dir
>      /path/to/main/worktree/.git
> 
> We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation
> to say so.

Thanks for making the documentation match reality. Are there some more instances than need to be changed? If I run

     git grep -n GIT_DIR/info origin/master Documentation/gitignore.adoc
I see

origin/master:Documentation/gitignore.adoc:10:$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore origin/master:Documentation/gitignore.adoc:37: * Patterns read from `$GIT_DIR/info/exclude`. origin/master:Documentation/gitignore.adoc:53: the `$GIT_DIR/info/exclude` file. origin/master:Documentation/gitignore.adoc:100: such as $GIT_DIR/info/exclude and core.excludesFile, are treated as if origin/master:Documentation/gitignore.adoc:149:`$GIT_DIR/info/exclude`. Patterns in the exclude file are used in addition to origin/master:Documentation/gitignore.adoc:150:those in `$GIT_DIR/info/exclude`.

We also have a ton of other files under Documentation that mention $GIT_DIR/info/... all of which, apart from the release notes, I think should probably be using $GIT_COMMON_DIR but we can always do that separately

Thanks
Phillip
Show 70 quoted lines
> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
> ---
> 
> Notes (benknoble/commits):
>      Changes in v2:
>      
>      Only adjust the documentation.
>      
>      brian points out that a more general extension would allow using more
>      info/ files as "per-worktree," which I don't have the impetus to
>      implement myself.
>      
>      Phillip and Junio asked for a concrete use case:
>      
>          A colleague is developing a tool for managing the "skill files" of
>          various LLM tools (Claude, Windsurf, etc.). The files have
>          requirements that make it hard to generically ignore them (e.g.,
>          filenames and front-matter have to match), but different tasks
>          (corresponding to worktrees) may want different active skills, so it
>          is desirable to ignore the files. Think of this like node_modules.
>      
>          Unfortunately, since per-worktree ignores don't work, the current
>          solution is to put a .gitignore file in the corresponding directory
>          with the installed skills that ignores itself and the installed
>          skills.
>      
>      Since overall reactions seem fairly negative (or require a more general
>      extension, which I think is probably the right course but not simply
>      implemented), I've opted to adjust the docs. They originally confused
>      me, as I was surprised when my colleague reported that per-worktree
>      ignores didn't work (the docs imply they should by use of $GIT_DIR).
>      
>      Link to v1: <e3ee0a11b566dd2cc605447c111ae4620bce0fe6.1777050300.git.ben.knoble+github@gmail.com>
>      
>      v1 notes:
>      
>      Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
>      
>      This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean'
>      into next, 2026-04-23)) but cleanly applies to master (94f057755b (Git
>      2.54, 2026-04-19)) and seen (50541634cb (Merge branch
>      'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
> 
>   Documentation/gitignore.adoc | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
> index a3d24e5c34..c423b650de 100644
> --- a/Documentation/gitignore.adoc
> +++ b/Documentation/gitignore.adoc
> @@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
>   
>   SYNOPSIS
>   --------
> -$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
> +$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
>   
>   DESCRIPTION
>   -----------
> @@ -34,7 +34,7 @@ precedence, the last matching pattern decides the outcome):
>      includes such `.gitignore` files in its repository, containing patterns for
>      files generated as part of the project build.
>   
> - * Patterns read from `$GIT_DIR/info/exclude`.
> + * Patterns read from `$GIT_COMMON_DIR/info/exclude`.
>   
>    * Patterns read from the file specified by the configuration
>      variable `core.excludesFile`.
> 
> base-commit: 4f69b47b940100b02630f745a52f9d9850f122b2
D. Ben KnobleMay 11, 2026, 19:55 UTC in reply to Phillip Wood on lore

Re: [PATCH v2] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR

On Mon, May 11, 2026 at 6:30 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 35 quoted lines
>
> On 08/05/2026 15:14, D. Ben Knoble wrote:
> > gitignore(5) says that the per-repository ignore file is
> > $GIT_DIR/info/exclude, but in a worktree that is not the case:
> >
> >      git rev-parse --git-path info/exclude
> >      /path/to/main/worktree/.git/info/exclude
> >      git rev-parse --git-common-dir
> >      /path/to/main/worktree/.git
> >
> > We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation
> > to say so.
>
> Thanks for making the documentation match reality. Are there some more
> instances than need to be changed? If I run
>
>      git grep -n GIT_DIR/info origin/master Documentation/gitignore.adoc
>
> I see
>
> origin/master:Documentation/gitignore.adoc:10:$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
> origin/master:Documentation/gitignore.adoc:37: * Patterns read from `$GIT_DIR/info/exclude`.
> origin/master:Documentation/gitignore.adoc:53:   the `$GIT_DIR/info/exclude` file.
> origin/master:Documentation/gitignore.adoc:100:   such as $GIT_DIR/info/exclude and core.excludesFile, are treated as if
> origin/master:Documentation/gitignore.adoc:149:`$GIT_DIR/info/exclude`. Patterns in the exclude file are used in addition to
> origin/master:Documentation/gitignore.adoc:150:those in `$GIT_DIR/info/exclude`.
>
> We also have a ton of other files under Documentation that mention
> $GIT_DIR/info/... all of which, apart from the release notes, I
> think should probably be using $GIT_COMMON_DIR but we can always do
> that separately
>
> Thanks
>
> Phillip

Good catch, thanks. Let me adjust the ignore-related ones and leave the rest for now.

D. Ben KnobleMay 12, 2026, 21:21 UTC in reply to D. Ben Knoble on lore

[PATCH v3] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR

gitignore(5) says that the per-repository ignore file is $GIT_DIR/info/exclude, but in a worktree that is not the case:

    git rev-parse --git-path info/exclude
    /path/to/main/worktree/.git/info/exclude
    git rev-parse --git-common-dir
    /path/to/main/worktree/.git

We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation and some code comments to say so.

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
Notes (benknoble/commits):
    Changes in v3:
    
    Adjust more occurrences
    
    Link to v2: <d58b6e921d3005c6170fc6c47f175214acb3fa68.1778249267.git.ben.knoble+github@gmail.com>
    
    Changes in v2:
    
    Only adjust the documentation.
    
    brian points out that a more general extension would allow using more
    info/ files as "per-worktree," which I don't have the impetus to
    implement myself.
    
    Phillip and Junio asked for a concrete use case:
    
        A colleague is developing a tool for managing the "skill files" of
        various LLM tools (Claude, Windsurf, etc.). The files have
        requirements that make it hard to generically ignore them (e.g.,
        filenames and front-matter have to match), but different tasks
        (corresponding to worktrees) may want different active skills, so it
        is desirable to ignore the files. Think of this like node_modules.
    
        Unfortunately, since per-worktree ignores don't work, the current
        solution is to put a .gitignore file in the corresponding directory
        with the installed skills that ignores itself and the installed
        skills.
    
    Since overall reactions seem fairly negative (or require a more general
    extension, which I think is probably the right course but not simply
    implemented), I've opted to adjust the docs. They originally confused
    me, as I was surprised when my colleague reported that per-worktree
    ignores didn't work (the docs imply they should by use of $GIT_DIR).
    
    Link to v1: <e3ee0a11b566dd2cc605447c111ae4620bce0fe6.1777050300.git.ben.knoble+github@gmail.com>
    
    v1 notes:
    
    Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
    
    This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean'
    into next, 2026-04-23)) but cleanly applies to master (94f057755b (Git
    2.54, 2026-04-19)) and seen (50541634cb (Merge branch
    'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
 Documentation/git-ls-files.adoc    |  2 +-
 Documentation/git-svn.adoc         |  2 +-
 Documentation/gitformat-index.adoc |  4 ++--
 Documentation/gitignore.adoc       | 12 ++++++------
 dir.c                              |  4 ++--
 dir.h                              |  2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)
Show changes to 6 files +13 −13

Documentation/git-ls-files.adoc, Documentation/git-svn.adoc, Documentation/gitformat-index.adoc, Documentation/gitignore.adoc, dir.c, dir.h

diff --git a/Documentation/git-ls-files.adoc b/Documentation/git-ls-files.adoc
index 58c529afbe..2b175388e1 100644
--- a/Documentation/git-ls-files.adoc
+++ b/Documentation/git-ls-files.adoc
@@ -331,7 +331,7 @@ can give `--exclude-per-directory=.gitignore`, and then specify:
   1. The file specified by the `core.excludesfile` configuration
      variable, if exists, or the `$XDG_CONFIG_HOME/git/ignore` file.
 
-  2. The `$GIT_DIR/info/exclude` file.
+  2. The `$GIT_COMMON_DIR/info/exclude` file.
 
 via the `--exclude-from=` option.
 
diff --git a/Documentation/git-svn.adoc b/Documentation/git-svn.adoc
index c26c12bab3..2a7fa60465 100644
--- a/Documentation/git-svn.adoc
+++ b/Documentation/git-svn.adoc
@@ -439,7 +439,7 @@ Any other arguments are passed directly to 'git log'
 'show-ignore'::
 	Recursively finds and lists the svn:ignore and svn:global-ignores
 	properties on directories. The output is suitable for appending to
-	the $GIT_DIR/info/exclude file.
+	the $GIT_COMMON_DIR/info/exclude file.
 
 'mkdirs'::
 	Attempts to recreate empty directories that core Git cannot track
diff --git a/Documentation/gitformat-index.adoc b/Documentation/gitformat-index.adoc
index 145cace1fe..f6a427cb49 100644
--- a/Documentation/gitformat-index.adoc
+++ b/Documentation/gitformat-index.adoc
@@ -291,14 +291,14 @@ Git index format
     sequence in variable width encoding. Each string describes the
     environment where the cache can be used.
 
-  - Stat data of $GIT_DIR/info/exclude. See "Index entry" section from
+  - Stat data of $GIT_COMMON_DIR/info/exclude. See "Index entry" section from
     ctime field until "file size".
 
   - Stat data of core.excludesFile
 
   - 32-bit dir_flags (see struct dir_struct)
 
-  - Hash of $GIT_DIR/info/exclude. A null hash means the file
+  - Hash of $GIT_COMMON_DIR/info/exclude. A null hash means the file
     does not exist.
 
   - Hash of core.excludesFile. A null hash means the file does
diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
index a3d24e5c34..7979e50f18 100644
--- a/Documentation/gitignore.adoc
+++ b/Documentation/gitignore.adoc
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
 
 SYNOPSIS
 --------
-$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
+$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
 
 DESCRIPTION
 -----------
@@ -34,7 +34,7 @@ precedence, the last matching pattern decides the outcome):
    includes such `.gitignore` files in its repository, containing patterns for
    files generated as part of the project build.
 
- * Patterns read from `$GIT_DIR/info/exclude`.
+ * Patterns read from `$GIT_COMMON_DIR/info/exclude`.
 
  * Patterns read from the file specified by the configuration
    variable `core.excludesFile`.
@@ -50,7 +50,7 @@ be used.
    specific to a particular repository but which do not need to be shared
    with other related repositories (e.g., auxiliary files that live inside
    the repository but are specific to one user's workflow) should go into
-   the `$GIT_DIR/info/exclude` file.
+   the `$GIT_COMMON_DIR/info/exclude` file.
 
  * Patterns which a user wants Git to
    ignore in all situations (e.g., backup or temporary files generated by
@@ -97,7 +97,7 @@ PATTERN FORMAT
    match at any level below the `.gitignore` level.
 
  - Patterns read from exclude sources that are outside the working tree,
-   such as $GIT_DIR/info/exclude and core.excludesFile, are treated as if
+   such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if
    they are specified at the root of the working tree, i.e. a leading "/"
    in such patterns anchors the match at the root of the repository.
 
@@ -146,8 +146,8 @@ CONFIGURATION
 
 The optional configuration variable `core.excludesFile` indicates a path to a
 file containing patterns of file names to exclude, similar to
-`$GIT_DIR/info/exclude`.  Patterns in the exclude file are used in addition to
-those in `$GIT_DIR/info/exclude`.
+`$GIT_COMMON_DIR/info/exclude`. Patterns in the exclude file are used in
+addition to those in `$GIT_COMMON_DIR/info/exclude`.
 
 NOTES
 -----
diff --git a/dir.c b/dir.c
index fcb8f6dd2a..33c81c256e 100644
--- a/dir.c
+++ b/dir.c
@@ -2985,7 +2985,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
 		return NULL;
 
 	/*
-	 * We only support $GIT_DIR/info/exclude and core.excludesfile
+	 * We only support $GIT_COMMON_DIR/info/exclude and core.excludesfile
 	 * as the global ignore rule files. Any other additions
 	 * (e.g. from command line) invalidate the cache. This
 	 * condition also catches running setup_standard_excludes()
@@ -3078,7 +3078,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
 		istate->cache_changed |= UNTRACKED_CHANGED;
 	}
 
-	/* Validate $GIT_DIR/info/exclude and core.excludesfile */
+	/* Validate $GIT_COMMON_DIR/info/exclude and core.excludesfile */
 	root = dir->untracked->root;
 	if (!oideq(&dir->internal.ss_info_exclude.oid,
 		   &dir->untracked->ss_info_exclude.oid)) {
diff --git a/dir.h b/dir.h
index 20d4a078d6..83e0f648a8 100644
--- a/dir.h
+++ b/dir.h
@@ -153,7 +153,7 @@ struct oid_stat {
  *   - The list of files and directories of the directory in question
  *   - The $GIT_DIR/index
  *   - dir_struct flags
- *   - The content of $GIT_DIR/info/exclude
+ *   - The content of $GIT_COMMON_DIR/info/exclude
  *   - The content of core.excludesfile
  *   - The content (or the lack) of .gitignore of all parent directories
  *     from $GIT_WORK_TREE

base-commit: 59709faab07346122d819453f4ad6f3ccdaf618e
-- 
2.54.0.564.ge3ee0a11b5.dirty
Phillip WoodMay 13, 2026, 14:02 UTC in reply to D. Ben Knoble on lore

Re: [PATCH v3] ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR

Hi Ben
On 12/05/2026 22:21, D. Ben Knoble wrote:
Show 10 quoted lines
> gitignore(5) says that the per-repository ignore file is
> $GIT_DIR/info/exclude, but in a worktree that is not the case:
> 
>      git rev-parse --git-path info/exclude
>      /path/to/main/worktree/.git/info/exclude
>      git rev-parse --git-common-dir
>      /path/to/main/worktree/.git
> 
> We actually use $GIT_COMMON_DIR/info/exclude. Adjust the documentation
> and some code comments to say so.
Thanks for the re-roll, this looks good to me
Phillip
Show 192 quoted lines
> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
> ---
> 
> Notes (benknoble/commits):
>      Changes in v3:
>      
>      Adjust more occurrences
>      
>      Link to v2: <d58b6e921d3005c6170fc6c47f175214acb3fa68.1778249267.git.ben.knoble+github@gmail.com>
>      
>      Changes in v2:
>      
>      Only adjust the documentation.
>      
>      brian points out that a more general extension would allow using more
>      info/ files as "per-worktree," which I don't have the impetus to
>      implement myself.
>      
>      Phillip and Junio asked for a concrete use case:
>      
>          A colleague is developing a tool for managing the "skill files" of
>          various LLM tools (Claude, Windsurf, etc.). The files have
>          requirements that make it hard to generically ignore them (e.g.,
>          filenames and front-matter have to match), but different tasks
>          (corresponding to worktrees) may want different active skills, so it
>          is desirable to ignore the files. Think of this like node_modules.
>      
>          Unfortunately, since per-worktree ignores don't work, the current
>          solution is to put a .gitignore file in the corresponding directory
>          with the installed skills that ignores itself and the installed
>          skills.
>      
>      Since overall reactions seem fairly negative (or require a more general
>      extension, which I think is probably the right course but not simply
>      implemented), I've opted to adjust the docs. They originally confused
>      me, as I was surprised when my colleague reported that per-worktree
>      ignores didn't work (the docs imply they should by use of $GIT_DIR).
>      
>      Link to v1: <e3ee0a11b566dd2cc605447c111ae4620bce0fe6.1777050300.git.ben.knoble+github@gmail.com>
>      
>      v1 notes:
>      
>      Discussed briefly at https://lore.kernel.org/git/CALnO6CCXmA+ATT7CuyWkU6P8qmLCCpMi5Ppr1c78s0heznpVyw@mail.gmail.com/T
>      
>      This is based on next (4f69b47b94 (Merge branch 'ps/test-set-e-clean'
>      into next, 2026-04-23)) but cleanly applies to master (94f057755b (Git
>      2.54, 2026-04-19)) and seen (50541634cb (Merge branch
>      'js/parseopt-subcommand-autocorrection' into seen, 2026-04-23)).
> 
>   Documentation/git-ls-files.adoc    |  2 +-
>   Documentation/git-svn.adoc         |  2 +-
>   Documentation/gitformat-index.adoc |  4 ++--
>   Documentation/gitignore.adoc       | 12 ++++++------
>   dir.c                              |  4 ++--
>   dir.h                              |  2 +-
>   6 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/git-ls-files.adoc b/Documentation/git-ls-files.adoc
> index 58c529afbe..2b175388e1 100644
> --- a/Documentation/git-ls-files.adoc
> +++ b/Documentation/git-ls-files.adoc
> @@ -331,7 +331,7 @@ can give `--exclude-per-directory=.gitignore`, and then specify:
>     1. The file specified by the `core.excludesfile` configuration
>        variable, if exists, or the `$XDG_CONFIG_HOME/git/ignore` file.
>   
> -  2. The `$GIT_DIR/info/exclude` file.
> +  2. The `$GIT_COMMON_DIR/info/exclude` file.
>   
>   via the `--exclude-from=` option.
>   
> diff --git a/Documentation/git-svn.adoc b/Documentation/git-svn.adoc
> index c26c12bab3..2a7fa60465 100644
> --- a/Documentation/git-svn.adoc
> +++ b/Documentation/git-svn.adoc
> @@ -439,7 +439,7 @@ Any other arguments are passed directly to 'git log'
>   'show-ignore'::
>   	Recursively finds and lists the svn:ignore and svn:global-ignores
>   	properties on directories. The output is suitable for appending to
> -	the $GIT_DIR/info/exclude file.
> +	the $GIT_COMMON_DIR/info/exclude file.
>   
>   'mkdirs'::
>   	Attempts to recreate empty directories that core Git cannot track
> diff --git a/Documentation/gitformat-index.adoc b/Documentation/gitformat-index.adoc
> index 145cace1fe..f6a427cb49 100644
> --- a/Documentation/gitformat-index.adoc
> +++ b/Documentation/gitformat-index.adoc
> @@ -291,14 +291,14 @@ Git index format
>       sequence in variable width encoding. Each string describes the
>       environment where the cache can be used.
>   
> -  - Stat data of $GIT_DIR/info/exclude. See "Index entry" section from
> +  - Stat data of $GIT_COMMON_DIR/info/exclude. See "Index entry" section from
>       ctime field until "file size".
>   
>     - Stat data of core.excludesFile
>   
>     - 32-bit dir_flags (see struct dir_struct)
>   
> -  - Hash of $GIT_DIR/info/exclude. A null hash means the file
> +  - Hash of $GIT_COMMON_DIR/info/exclude. A null hash means the file
>       does not exist.
>   
>     - Hash of core.excludesFile. A null hash means the file does
> diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
> index a3d24e5c34..7979e50f18 100644
> --- a/Documentation/gitignore.adoc
> +++ b/Documentation/gitignore.adoc
> @@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
>   
>   SYNOPSIS
>   --------
> -$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
> +$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
>   
>   DESCRIPTION
>   -----------
> @@ -34,7 +34,7 @@ precedence, the last matching pattern decides the outcome):
>      includes such `.gitignore` files in its repository, containing patterns for
>      files generated as part of the project build.
>   
> - * Patterns read from `$GIT_DIR/info/exclude`.
> + * Patterns read from `$GIT_COMMON_DIR/info/exclude`.
>   
>    * Patterns read from the file specified by the configuration
>      variable `core.excludesFile`.
> @@ -50,7 +50,7 @@ be used.
>      specific to a particular repository but which do not need to be shared
>      with other related repositories (e.g., auxiliary files that live inside
>      the repository but are specific to one user's workflow) should go into
> -   the `$GIT_DIR/info/exclude` file.
> +   the `$GIT_COMMON_DIR/info/exclude` file.
>   
>    * Patterns which a user wants Git to
>      ignore in all situations (e.g., backup or temporary files generated by
> @@ -97,7 +97,7 @@ PATTERN FORMAT
>      match at any level below the `.gitignore` level.
>   
>    - Patterns read from exclude sources that are outside the working tree,
> -   such as $GIT_DIR/info/exclude and core.excludesFile, are treated as if
> +   such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if
>      they are specified at the root of the working tree, i.e. a leading "/"
>      in such patterns anchors the match at the root of the repository.
>   
> @@ -146,8 +146,8 @@ CONFIGURATION
>   
>   The optional configuration variable `core.excludesFile` indicates a path to a
>   file containing patterns of file names to exclude, similar to
> -`$GIT_DIR/info/exclude`.  Patterns in the exclude file are used in addition to
> -those in `$GIT_DIR/info/exclude`.
> +`$GIT_COMMON_DIR/info/exclude`. Patterns in the exclude file are used in
> +addition to those in `$GIT_COMMON_DIR/info/exclude`.
>   
>   NOTES
>   -----
> diff --git a/dir.c b/dir.c
> index fcb8f6dd2a..33c81c256e 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -2985,7 +2985,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
>   		return NULL;
>   
>   	/*
> -	 * We only support $GIT_DIR/info/exclude and core.excludesfile
> +	 * We only support $GIT_COMMON_DIR/info/exclude and core.excludesfile
>   	 * as the global ignore rule files. Any other additions
>   	 * (e.g. from command line) invalidate the cache. This
>   	 * condition also catches running setup_standard_excludes()
> @@ -3078,7 +3078,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
>   		istate->cache_changed |= UNTRACKED_CHANGED;
>   	}
>   
> -	/* Validate $GIT_DIR/info/exclude and core.excludesfile */
> +	/* Validate $GIT_COMMON_DIR/info/exclude and core.excludesfile */
>   	root = dir->untracked->root;
>   	if (!oideq(&dir->internal.ss_info_exclude.oid,
>   		   &dir->untracked->ss_info_exclude.oid)) {
> diff --git a/dir.h b/dir.h
> index 20d4a078d6..83e0f648a8 100644
> --- a/dir.h
> +++ b/dir.h
> @@ -153,7 +153,7 @@ struct oid_stat {
>    *   - The list of files and directories of the directory in question
>    *   - The $GIT_DIR/index
>    *   - dir_struct flags
> - *   - The content of $GIT_DIR/info/exclude
> + *   - The content of $GIT_COMMON_DIR/info/exclude
>    *   - The content of core.excludesfile
>    *   - The content (or the lack) of .gitignore of all parent directories
>    *     from $GIT_WORK_TREE
> 
> base-commit: 59709faab07346122d819453f4ad6f3ccdaf618e

Back to recent threads