Skip to content

Commit bd40c65

Browse files
benknoblegitster
authored andcommitted
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 94f0577 commit bd40c65

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

Documentation/git-ls-files.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ can give `--exclude-per-directory=.gitignore`, and then specify:
331331
1. The file specified by the `core.excludesfile` configuration
332332
variable, if exists, or the `$XDG_CONFIG_HOME/git/ignore` file.
333333
334-
2. The `$GIT_DIR/info/exclude` file.
334+
2. The `$GIT_COMMON_DIR/info/exclude` file.
335335
336336
via the `--exclude-from=` option.
337337

Documentation/git-svn.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Any other arguments are passed directly to 'git log'
439439
'show-ignore'::
440440
Recursively finds and lists the svn:ignore and svn:global-ignores
441441
properties on directories. The output is suitable for appending to
442-
the $GIT_DIR/info/exclude file.
442+
the $GIT_COMMON_DIR/info/exclude file.
443443

444444
'mkdirs'::
445445
Attempts to recreate empty directories that core Git cannot track

Documentation/gitformat-index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,14 @@ Git index format
291291
sequence in variable width encoding. Each string describes the
292292
environment where the cache can be used.
293293

294-
- Stat data of $GIT_DIR/info/exclude. See "Index entry" section from
294+
- Stat data of $GIT_COMMON_DIR/info/exclude. See "Index entry" section from
295295
ctime field until "file size".
296296

297297
- Stat data of core.excludesFile
298298

299299
- 32-bit dir_flags (see struct dir_struct)
300300

301-
- Hash of $GIT_DIR/info/exclude. A null hash means the file
301+
- Hash of $GIT_COMMON_DIR/info/exclude. A null hash means the file
302302
does not exist.
303303

304304
- Hash of core.excludesFile. A null hash means the file does

Documentation/gitignore.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
77

88
SYNOPSIS
99
--------
10-
$XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore
10+
$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
1111

1212
DESCRIPTION
1313
-----------
@@ -34,7 +34,7 @@ precedence, the last matching pattern decides the outcome):
3434
includes such `.gitignore` files in its repository, containing patterns for
3535
files generated as part of the project build.
3636

37-
* Patterns read from `$GIT_DIR/info/exclude`.
37+
* Patterns read from `$GIT_COMMON_DIR/info/exclude`.
3838

3939
* Patterns read from the file specified by the configuration
4040
variable `core.excludesFile`.
@@ -50,7 +50,7 @@ be used.
5050
specific to a particular repository but which do not need to be shared
5151
with other related repositories (e.g., auxiliary files that live inside
5252
the repository but are specific to one user's workflow) should go into
53-
the `$GIT_DIR/info/exclude` file.
53+
the `$GIT_COMMON_DIR/info/exclude` file.
5454

5555
* Patterns which a user wants Git to
5656
ignore in all situations (e.g., backup or temporary files generated by
@@ -97,7 +97,7 @@ PATTERN FORMAT
9797
match at any level below the `.gitignore` level.
9898
9999
- Patterns read from exclude sources that are outside the working tree,
100-
such as $GIT_DIR/info/exclude and core.excludesFile, are treated as if
100+
such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if
101101
they are specified at the root of the working tree, i.e. a leading "/"
102102
in such patterns anchors the match at the root of the repository.
103103
@@ -146,8 +146,8 @@ CONFIGURATION
146146

147147
The optional configuration variable `core.excludesFile` indicates a path to a
148148
file containing patterns of file names to exclude, similar to
149-
`$GIT_DIR/info/exclude`. Patterns in the exclude file are used in addition to
150-
those in `$GIT_DIR/info/exclude`.
149+
`$GIT_COMMON_DIR/info/exclude`. Patterns in the exclude file are used in
150+
addition to those in `$GIT_COMMON_DIR/info/exclude`.
151151

152152
NOTES
153153
-----

dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,7 +2985,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
29852985
return NULL;
29862986

29872987
/*
2988-
* We only support $GIT_DIR/info/exclude and core.excludesfile
2988+
* We only support $GIT_COMMON_DIR/info/exclude and core.excludesfile
29892989
* as the global ignore rule files. Any other additions
29902990
* (e.g. from command line) invalidate the cache. This
29912991
* condition also catches running setup_standard_excludes()
@@ -3078,7 +3078,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
30783078
istate->cache_changed |= UNTRACKED_CHANGED;
30793079
}
30803080

3081-
/* Validate $GIT_DIR/info/exclude and core.excludesfile */
3081+
/* Validate $GIT_COMMON_DIR/info/exclude and core.excludesfile */
30823082
root = dir->untracked->root;
30833083
if (!oideq(&dir->internal.ss_info_exclude.oid,
30843084
&dir->untracked->ss_info_exclude.oid)) {

dir.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ struct oid_stat {
153153
* - The list of files and directories of the directory in question
154154
* - The $GIT_DIR/index
155155
* - dir_struct flags
156-
* - The content of $GIT_DIR/info/exclude
156+
* - The content of $GIT_COMMON_DIR/info/exclude
157157
* - The content of core.excludesfile
158158
* - The content (or the lack) of .gitignore of all parent directories
159159
* from $GIT_WORK_TREE

0 commit comments

Comments
 (0)