git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] gitattributes.txt: Path matching rules are explained in gitignore.txt

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Feb 25, 2009, 07:54 UTC
Message-ID
<49A4F942.1090907@viscovery.net>
In-Reply-To
<7vskm3hh8n.fsf@gitster.siamese.dyndns.org>
From: Johannes Sixt <j6t@kdbg.org>

The rules how the patterns are matched against path names are the same for .gitattribute and .gitignore files.

This also replace the notion "glob pattern" by "pattern" because gitignore.txt talks about "glob" only in some contexts where the pattern is mentioned.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 Junio C Hamano schrieb:
 > Actually, while I was responding to your message, I looked at
 > gitattributes documentation and noticed that it does not say anything
 > about how the "glob" is used to match paths.
 Here's a patch.
 -- Hannes
 Documentation/gitattributes.txt |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 227934f..55668e3 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -18,10 +18,10 @@ A `gitattributes` file is a simple text

 Each line in `gitattributes` file is of form:

-	glob	attr1 attr2 ...
+	pattern	attr1 attr2 ...

-That is, a glob pattern followed by an attributes list,
-separated by whitespaces.  When the glob pattern matches the
+That is, a pattern followed by an attributes list,
+separated by whitespaces.  When the pattern matches the
 path in question, the attributes listed on the line are given to
 the path.

@@ -48,13 +48,14 @@ Set to a value::

 Unspecified::

-	No glob pattern matches the path, and nothing says if
+	No pattern matches the path, and nothing says if
 	the path has or does not have the attribute, the
 	attribute for the path is said to be Unspecified.

-When more than one glob pattern matches the path, a later line
+When more than one pattern matches the path, a later line
 overrides an earlier line.  This overriding is done per
-attribute.
+attribute.  The rules how the pattern matches paths are the
+same as in `.gitignore` files; see linkgit:gitignore[5].

 When deciding what attributes are assigned to a path, git
 consults `$GIT_DIR/info/attributes` file (which has the highest
-- 
1.6.2.rc0.81.g1e300
Previous: Junio C HamanoNext: Johannes Sixt
Message 5 of 6 in “git-gui: Fix file name pattern in .gitattributes.”
  1. git-gui: Fix file name pattern in .gitattributes.Johannes Sixt, Feb 24, 2009
  2. Junio C HamanoFeb 24, 2009
  3. Johannes SixtFeb 24, 2009
  4. Junio C HamanoFeb 24, 2009
  5. 1/2 gitattributes.txt: Path matching rules are explained in gitignore.txtJohannes Sixt, Feb 25, 2009
  6. Johannes SixtFeb 25, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.