docs: .gitignore in parents is current repo only
PATCH 1/1 docs: .gitignore in parents is current repo only
The current documentation reads as if .gitignore files will be parsed in every parent directory, and not until they reach a repository boundary. This clarifies the current behaviour.
--- Documentation/gitignore.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/gitignore.txt +4 -4
@@ -27,10 +27,10 @@ precedence, the last matching pattern decides the outcome): them. * Patterns read from a `.gitignore` file in the same directory - as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the + as the path, or in any parent directory in the same repository, with + patterns in the higher level files (up to the toplevel of the work tree) + being overridden by those in lower level files down to the directory + containing the file. These patterns match relative to the location of the `.gitignore` file. A project normally includes such `.gitignore` files in its repository, containing patterns for files generated as part of the project build.
Signature · 1 line
2.31.1
Quoted 2 lines · Andrew Berry
The current documentation reads as if .gitignore files will be parsed in every parent directory, and not until they reach a repository boundary.
Hmph. While it is not adding an incorrect information to the documentation per-se, I am not sure if this is necessary to begin with. I would have thought that "up to the toplevel of the work tree" would be sufficiently clear where the upward traversal of the directories ends, i.e. at the repository boundary.
Quoted 12 lines
* Patterns read from a
.gitignorefile in the same directoryDocumentation/gitignore.txt +4
-4- as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the + as the path, or in any parent directory in the same repository, with + patterns in the higher level files (up to the toplevel of the work tree) + being overridden by those in lower level files down to the directory + containing the file. These patterns match relative to the location of the `.gitignore` file. A project normally includes such `.gitignore` files in its repository, containing patterns for files generated as part of the project build.
Documentation/gitignore.txt precedence, the last matching pattern decides the outcome): · line 33
Quoted 9 lines · Andrew Berry
* Patterns read from a
.gitignorefile in the same directoryDocumentation/gitignore.txt +4
-4- as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the + as the path, or in any parent directory in the same repository, with + patterns in the higher level files (up to the toplevel of the work tree) + being overridden by those in lower level files down to the directory + containing the file. These patterns match relative to the location of the
So for example I have something/foo in ../.gitignore, but .gitignore (in current directory something) has foo. Is .gitignore from current directory or ../.gitignore takes effect?
Also s/toplevel/top level/
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 3 lines · Junio C Hamano
I would have thought that "up to the toplevel of the work tree" would be sufficiently clear where the upward traversal of the directories ends, i.e. at the repository boundary.
Seems reasonable. What if we move that note to come after "any parent directory"?
Quoted 1 line · Bagas Sanjaya
So for example I have
something/fooin ../.gitignore, but .gitignore (in current directorysomething) hasfoo. Is .gitignore from current directory or ../.gitignore takes effect?
In this case, both rules resolve to the same path, so I don't think it matters? But in practice I'd expect it to be something/.gitignore, since you can negate the pattern from the parent ignore file.
Quoted 1 line
Also s/toplevel/top level/
That showed up in the diff due to word wrapping. If no other changes are accepted, I'll file a followup after to get this fixed on it's own.
Quoted 8 lines · Andrew Berry
Quoted 3 lines · Junio C Hamano
I would have thought that "up to the toplevel of the work tree" would be sufficiently clear where the upward traversal of the directories ends, i.e. at the repository boundary.
Seems reasonable. What if we move that note to come after "any parent directory"?
Meaning something like the following?
I do agree that it makes it a lot clearer.
Documentation/gitignore.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/gitignore.txt +2 -2
@@ -27,8 +27,8 @@ precedence, the last matching pattern decides the outcome): them. * Patterns read from a `.gitignore` file in the same directory - as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden + as the path, or in any parent directory (up to the toplevel of + the work tree), with patterns in the higher level files being overridden by those in lower level files down to the directory containing the file. These patterns match relative to the location of the `.gitignore` file. A project normally includes such
Quoted 23 lines · Junio C Hamano
"Andrew Berry" <[email protected]> writes:
Meaning something like the following?
I do agree that it makes it a lot clearer.
Documentation/gitignore.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Documentation/gitignore.txt +0
-0@@ -27,8 +27,8 @@ precedence, the last matching pattern decides theoutcome):
them.* Patterns read from a
.gitignorefile in the same directoryDocumentation/gitignore.txt +0
-2- as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) beingoverridden
Documentation/gitignore.txt +2
-0+ as the path, or in any parent directory (up to the toplevel of + the work tree), with patterns in the higher level files being
Quoted 5 lines
overridden
by those in lower level files down to the directory containing the
file.
These patterns match relative to the location of the.gitignorefile. A project normally includes such
Yes, that's good. My only suggestion would mirror the earlier one, to split toplevel to "top-level" or "top level".
Quoted 1 line · Andrew Berry
split toplevel to "top-level" or "top level".
Ah, that's even better.
PATCH 1/1 docs: .gitignore parsing is to the top of the repo
The current documentation reads as if .gitignore files will be parsed in every parent directory, and not until they reach a repository boundary. This clarifies the current behaviour.
As well, this corrects 'toplevel' to 'top-level', matching usage for 'top-level domain'.
--- Documentation/gitignore.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/gitignore.txt +4 -4
@@ -27,10 +27,10 @@ precedence, the last matching pattern decides the outcome): them. * Patterns read from a `.gitignore` file in the same directory - as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the + as the path, or in any parent directory in the same repository, with + patterns in the higher level files (up to the toplevel of the work tree) + being overridden by those in lower level files down to the directory + containing the file. These patterns match relative to the location of the `.gitignore` file. A project normally includes such `.gitignore` files in its repository, containing patterns for files generated as part of the project build.
Signature · 1 line
2.31.1
PATCH 1/1 docs: .gitignore parsing is to the top of the repo
The current documentation reads as if .gitignore files will be parsed in every parent directory, and not until they reach a repository boundary. This clarifies the current behaviour.
As well, this corrects 'toplevel' to 'top-level', matching usage for 'top-level domain'.
--- Documentation/gitignore.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Documentation/gitignore.txt +5 -6
@@ -27,12 +27,11 @@ precedence, the last matching pattern decides the outcome): them. * Patterns read from a `.gitignore` file in the same directory - as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the - `.gitignore` file. A project normally includes such - `.gitignore` files in its repository, containing patterns for + as the path, or in any parent directory (up to the top-level of the work + tree), with patterns in the higher level files being overridden by those in + lower level files down to the directory containing the file. These patterns + match relative to the location of the `.gitignore` file. A project normally + 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`.
Signature · 1 line
2.31.1
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
Documentation/gitignore.txt precedence, the last matching pattern decides the outcome): · line 35
Quoted 13 lines · Andrew Berry
* Patterns read from a
.gitignorefile in the same directoryDocumentation/gitignore.txt +5
-6- as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the - `.gitignore` file. A project normally includes such - `.gitignore` files in its repository, containing patterns for + as the path, or in any parent directory (up to the top-level of the work + tree), with patterns in the higher level files being overridden by those in + lower level files down to the directory containing the file. These patterns + match relative to the location of the `.gitignore` file. A project normally + includes such `.gitignore` files in its repository, containing patterns for files generated as part of the project build.
Line rewrapping makes it hard to see what actually got changed, but does this only move "(up to the top-level of the work tree)" around without anything else, as discussed?
If you do "toplevel" -> "top-level" while at it, perhaps we would want to correct "work tree" -> "working tree".
Looking better.
Thanks.
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
Quoted 16 lines · Junio C Hamano
Documentation/gitignore.txt precedence, the last matching pattern decides the outcome): · line 35
Quoted 13 lines · Andrew Berry
* Patterns read from a
.gitignorefile in the same directoryDocumentation/gitignore.txt +5
-6- as the path, or in any parent directory, with patterns in the - higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the - `.gitignore` file. A project normally includes such - `.gitignore` files in its repository, containing patterns for + as the path, or in any parent directory (up to the top-level of the work + tree), with patterns in the higher level files being overridden by those in + lower level files down to the directory containing the file. These patterns + match relative to the location of the `.gitignore` file. A project normally + includes such `.gitignore` files in its repository, containing patterns for files generated as part of the project build.
Quoted 8 lines
Line rewrapping makes it hard to see what actually got changed, but does this only move "(up to the top-level of the work tree)" around without anything else, as discussed?
If you do "toplevel" -> "top-level" while at it, perhaps we would want to correct "work tree" -> "working tree".
Looking better.
Another tangent. The discovery process used for the .gitattributes files is identical to what is done to the .gitignore files; we may want to make sure that the explanation we give in our documentation won't cause the same confusion you are trying to avoid with this change. Such a fix does not have to be (and probably should not be) a part of this change, though.
Thanks.
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
Quoted 3 lines · Junio C Hamano
Quoted 2 lines · Junio C Hamano
Line rewrapping makes it hard to see what actually got changed,
To check, that's asked for, correct? Or is it better to do one commit with the word changes, another to clean up the wrapping?
Quoted 8 lines
Quoted 8 lines
but
does this only move "(up to the top-level of the work tree)" around without anything else, as discussed?If you do "toplevel" -> "top-level" while at it, perhaps we would want to correct "work tree" -> "working tree".
Looking better.
Yes, I realized I sent the wrong file when reviewing the sent email, hence the followup. Aside, it's not clear to me how to send patch emails that _also_ have not-to-be-committed notes like "oops, ignore the last". First time contributor problems!
Quoted 6 lines
Another tangent. The discovery process used for the .gitattributes files is identical to what is done to the .gitignore files; we may want to make sure that the explanation we give in our documentation won't cause the same confusion you are trying to avoid with this change. Such a fix does not have to be (and probably should not be) a part of this change, though.
I'm out of the office for the next week, but otherwise I'm glad to take that on when I'm back if no one else picks it up.
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
Quoted 4 lines · Andrew Berry
Quoted 1 line
Quoted 1 line
Line rewrapping makes it hard to see what actually got changed,
To check, that's asked for, correct? Or is it better to do one commit with the word changes, another to clean up the wrapping?
We do not encourage one-word-per-line or other silliness, but as long as the source is readable enough, there is no need for line re-wrapping, and I suspect that principle would apply.
Quoted 9 lines
Quoted 6 lines
Another tangent. The discovery process used for the .gitattributes files is identical to what is done to the .gitignore files; we may want to make sure that the explanation we give in our documentation won't cause the same confusion you are trying to avoid with this change. Such a fix does not have to be (and probably should not be) a part of this change, though.
I'm out of the office for the next week, but otherwise I'm glad to take that on when I'm back if no one else picks it up.
Here is how we describe the .gitattributes side:
When deciding what attributes are assigned to a path, Git consults $GIT_DIR/info/attributes file (which has the highest precedence), .gitattributes file in the same directory as the path in question, and its parent directories up to the toplevel of the work tree (the further the directory that contains .gitattributes is from the path in question, the lower its precedence). Finally global and system-wide files are considered (they have the lowest precedence).
I think we are already good on this side.
Thanks.
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
In reply to Junio C HamanoQuoted 2 lines · Junio C Hamano
If you do "toplevel" -> "top-level" while at it, perhaps we would want to correct "work tree" -> "working tree".
Rather than think of this as a one-off fix, I thought to look to see how many instances of each are currently used.
toplevel: 246
top-level: 119
work tree: 538
working tree: 2610
Since many of these instances are in translated strings, and that the text is understandable with any of the variants, I don't think it's worth changing. "Our standard is no standard" etc.
That leaves bringing the note about the work tree earlier in the sentence. Here's a hopefully easier to read word-diff. Look good?
Documentation/gitignore.txt +0 -0
@@ -27,12 +27,11 @@ precedence, the last matching pattern decides the outcome): them. * Patterns read from a `.gitignore` file in the same directory as the path, or in any parent [-directory, with patterns in the-]
[- higher level files-]{+directory+} (up to the toplevel of the work
[-tree)-]{+tree), with patterns in the higher level files+} being
overridden by those in
lower level files down to the directory containing the file. These
patterns
match relative to the location of the .gitignore file. A project
normally
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.
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
Quoted 8 lines · Andrew Berry
Quoted 2 lines · Junio C Hamano
If you do "toplevel" -> "top-level" while at it, perhaps we would want to correct "work tree" -> "working tree".
Rather than think of this as a one-off fix, I thought to look to see how many instances of each are currently used.
Quoted 8 lines
toplevel: 246
top-level: 119
work tree: 538
working tree: 2610Since many of these instances are in translated strings, and that the text is understandable with any of the variants, I don't think it's worth changing. "Our standard is no standard" etc.
So using "working tree" and "toplevel" might be adjusting to majority, but I agree that there are so numerous that tweaking only one "toplevel" (or another "work tree") should not distract the main point of this patch.
Thanks for stepping back and thinking it carefully. I wish everybody did more of that ;-)
Quoted 2 lines
That leaves bringing the note about the work tree earlier in the sentence. Here's a hopefully easier to read word-diff. Look good?
Sure, but the thing is that the version of the patch (with the change from toplevel to top-level) has already been in 'next' for more than a week.
Thanks.
Quoted 22 lines
Documentation/gitignore.txt +0
-0@@ -27,12 +27,11 @@ precedence, the last matching pattern decides theoutcome):
them.* Patterns read from a
.gitignorefile in the same directory as the path, or in any parent [-directory, with patterns in the-]
[- higher level files-]{+directory+} (up to the toplevel of the work
[-tree)-]{+tree), with patterns in the higher level files+} being overridden by those in
lower level files down to the directory containing the file. These patterns
match relative to the location of the.gitignorefile. A project normally
includes such.gitignorefiles in its repository, containing patterns for
files generated as part of the project build.* Patterns read from
$GIT_DIR/info/exclude.
Re: [PATCH] docs: .gitignore parsing is to the top of the repo
In reply to Andrew BerryQuoted 21 lines · Andrew Berry
The current documentation reads as if .gitignore files will be parsed in every parent directory, and not until they reach a repository boundary. This clarifies the current behaviour.
As well, this corrects 'toplevel' to 'top-level', matching usage for 'top-level domain'.
Signed-off-by Andrew Berry <[email protected]>--- Documentation/gitignore.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Documentation/gitignore.txt +0
-1@@ -27,10 +27,10 @@ precedence, the last matching pattern decides the outcome): them. * Patterns read from a `.gitignore` file in the same directory - as the path, or in any parent directory, with patterns in the
Documentation/gitignore.txt precedence, the last matching pattern decides the outcome): · line 36
Quoted 10 lines
Documentation/gitignore.txt +4
-3- higher level files (up to the toplevel of the work tree) being overridden - by those in lower level files down to the directory containing the file. - These patterns match relative to the location of the + as the path, or in any parent directory in the same repository, with + patterns in the higher level files (up to the toplevel of the work tree) + being overridden by those in lower level files down to the directory + containing the file. These patterns match relative to the location of the `.gitignore` file. A project normally includes such `.gitignore` files in its repository, containing patterns for files generated as part of the project build.
Sent a wrong/stale patch?