From 88e7fdf2cb436e068434241b0519577293055c19 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 19 Apr 2007 20:48:03 -0700 Subject: Document gitattributes(5) Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 285 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 Documentation/gitattributes.txt (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt new file mode 100644 index 0000000000..ece58abee2 --- /dev/null +++ b/Documentation/gitattributes.txt @@ -0,0 +1,285 @@ +gitattributes(5) +================ + +NAME +---- +gitattributes - defining attributes per path + +SYNOPSIS +-------- +.gitattributes + + +DESCRIPTION +----------- + +A `gitattributes` file is a simple text file that gives +`attributes` to pathnames. + +Each line in `gitattributes` file is of form: + + glob attr1 attr2 ... + +That is, a glob pattern followed by an attributes list, +separated by whitespaces. When the glob pattern matches the +path in question, the attributes listed on the line are given to +the path. + +Each attribute can be in one of these states for a given path: + +Set:: + + The path has the attribute with special value "true"; + this is specified by listing only the name of the + attribute in the attribute list. + +Unset:: + + The path has the attribute with special value "false"; + this is specified by listing the name of the attribute + prefixed with a dash `-` in the attribute list. + +Set to a value:: + + The path has the attribute with specified string value; + this is specified by listing the name of the attribute + followed by an equal sign `=` and its value in the + attribute list. + +Unspecified:: + + No glob pattern matches the path, and nothing says if + the path has or does not have the attribute. + +When more than one glob pattern matches the path, a later line +overrides an earlier line. + +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 (the further the +directory that contains `.gitattributes` is from the path in +question, the lower its precedence). + +Sometimes you would need to override an setting of an attribute +for a path to `unspecified` state. This can be done by listing +the name of the attribute prefixed with an exclamation point `!`. + + +EFFECTS +------- + +Certain operations by git can be influenced by assigning +particular attributes to a path. Currently, three operations +are attributes-aware. + +Checking-out and checking-in +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The attribute `crlf` affects how the contents stored in the +repository are copied to the working tree files when commands +such as `git checkout` and `git merge` run. It also affects how +git stores the contents you prepare in the working tree in the +repository upon `git add` and `git commit`. + +Set:: + + Setting the `crlf` attribute on a path is meant to mark + the path as a "text" file. 'core.autocrlf' conversion + takes place without guessing the content type by + inspection. + +Unset:: + + Unsetting the `crlf` attribute on a path is meant to + mark the path as a "binary" file. The path never goes + through line endings conversion upon checkin/checkout. + +Unspecified:: + + Unspecified `crlf` attribute tells git to apply the + `core.autocrlf` conversion when the file content looks + like text. + +Set to string value "input":: + + This is similar to setting the attribute to `true`, but + also forces git to act as if `core.autocrlf` is set to + `input` for the path. + +Any other value set to `crlf` attribute is ignored and git acts +as if the attribute is left unspecified. + + +The `core.autocrlf` conversion +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If the configuration variable `core.autocrlf` is false, no +conversion is done. + +When `core.autocrlf` is true, it means that the platform wants +CRLF line endings for files in the working tree, and you want to +convert them back to the normal LF line endings when checking +in to the repository. + +When `core.autocrlf` is set to "input", line endings are +converted to LF upon checkin, but there is no conversion done +upon checkout. + + +Generating diff text +~~~~~~~~~~~~~~~~~~~~ + +The attribute `diff` affects if `git diff` generates textual +patch for the path or just says `Binary files differ`. + +Set:: + + A path to which the `diff` attribute is set is treated + as text, even when they contain byte values that + normally never appear in text files, such as NUL. + +Unset:: + + A path to which the `diff` attribute is unset will + generate `Binary files differ`. + +Unspecified:: + + A path to which the `diff` attribute is unspecified + first gets its contents inspected, and if it looks like + text, it is treated as text. Otherwise it would + generate `Binary files differ`. + +Any other value set to `diff` attribute is ignored and git acts +as if the attribute is left unspecified. + + +Performing a three-way merge +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The attribute `merge` affects how three versions of a file is +merged when a file-level merge is necessary during `git merge`, +and other programs such as `git revert` and `git cherry-pick`. + +Set:: + + Built-in 3-way merge driver is used to merge the + contents in a way similar to `merge` command of `RCS` + suite. This is suitable for ordinary text files. + +Unset:: + + Take the version from the current branch as the + tentative merge result, and declare that the merge has + conflicts. This is suitable for binary files that does + not have a well-defined merge semantics. + +Unspecified:: + + By default, this uses the same built-in 3-way merge + driver as is the case the `merge` attribute is set. + However, `merge.default` configuration variable can name + different merge driver to be used for paths to which the + `merge` attribute is unspecified. + +Any other string value:: + + 3-way merge is performed using the specified custom + merge driver. The built-in 3-way merge driver can be + explicitly specified by asking for "text" driver; the + built-in "take the current branch" driver can be + requested by "binary". + + +Defining a custom merge driver +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The definition of a merge driver is done in `gitconfig` not +`gitattributes` file, so strictly speaking this manual page is a +wrong place to talk about it. However... + +To define a custom merge driver `filfre`, add a section to your +`$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this: + +---------------------------------------------------------------- +[merge "filfre"] + name = feel-free merge driver + driver = filfre %O %A %B + recursive = binary +---------------------------------------------------------------- + +The `merge.*.name` variable gives the driver a human-readable +name. + +The `merge.*.driver` variable's value is used to construct a +command to run to merge ancestor's version (`%O`), current +version (`%A`) and the other branches' version (`%B`). These +three tokens are replaced with the names of temporary files that +hold the contents of these versions when the command line is +built. + +The merge driver is expected to leave the result of the merge in +the file named with `%A` by overwriting it, and exit with zero +status if it managed to merge them cleanly, or non-zero if there +were conflicts. + +The `merge.*.recursive` variable specifies what other merge +driver to use when the merge driver is called for an internal +merge between common ancestors, when there are more than one. +When left unspecified, the driver itself is used for both +internal merge and the final merge. + + +EXAMPLE +------- + +If you have these three `gitattributes` file: + +---------------------------------------------------------------- +(in $GIT_DIR/info/attributes) + +a* foo !bar -baz + +(in .gitattributes) +abc foo bar baz + +(in t/.gitattributes) +ab* merge=filfre +abc -foo -bar +*.c frotz +---------------------------------------------------------------- + +the attributes given to path `t/abc` are computed as follows: + +1. By examining `t/.gitattributes` (which is in the same + diretory as the path in question), git finds that the first + line matches. `merge` attribute is set. It also finds that + the second line matches, and attributes `foo` and `bar` + are unset. + +2. Then it examines `.gitattributes` (which is in the parent + directory), and finds that the first line matches, but + `t/.gitattributes` file already decided how `merge`, `foo` + and `bar` attributes should be given to this path, so it + leaves `foo` and `bar` unset. Attribute `baz` is set. + +3. Finally it examines `$GIT_DIR/info/gitattributes`. This file + is used to override the in-tree settings. The first line is + a match, and `foo` is set, `bar` is reverted to unspecified + state, and `baz` is unset. + +As the result, the attributes assignement to `t/abc` becomes: + +---------------------------------------------------------------- +foo set to true +bar unspecified +baz set to false +merge set to string value "filfre" +frotz unspecified +---------------------------------------------------------------- + + +GIT +--- +Part of the gitlink:git[7] suite -- cgit v1.2.3 From 2d76548b6af66c49acaf0af7819c6dfb8fcf3389 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 22 Apr 2007 00:11:41 -0700 Subject: Documentation/Makefile: fix section (5) installation Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index ece58abee2..126871756d 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -7,7 +7,7 @@ gitattributes - defining attributes per path SYNOPSIS -------- -.gitattributes +$GIT_DIR/info/attributes, gitattributes DESCRIPTION -- cgit v1.2.3 From 2cc3167c688d1c91bc4cb9b1caa737b9d4971056 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 23 Apr 2007 00:21:02 -0700 Subject: Document "diff=driver" attribute Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 126871756d..d2edb9b14a 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -151,8 +151,34 @@ Unspecified:: text, it is treated as text. Otherwise it would generate `Binary files differ`. -Any other value set to `diff` attribute is ignored and git acts -as if the attribute is left unspecified. +String:: + + Diff is shown using the specified custom diff driver. + The driver program is given its input using the same + calling convention as used for GIT_EXTERNAL_DIFF + program. + + +Defining a custom diff driver +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The definition of a diff driver is done in `gitconfig`, not +`gitattributes` file, so strictly speaking this manual page is a +wrong place to talk about it. However... + +To define a custom diff driver `jcdiff`, add a section to your +`$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this: + +---------------------------------------------------------------- +[diff "jcdiff"] + command = j-c-diff +---------------------------------------------------------------- + +When git needs to show you a diff for the path with `diff` +attribute set to `jcdiff`, it calls the command you specified +with the above configuration, i.e. `j-c-diff`, with 7 +parameters, just like `GIT_EXTERNAL_DIFF` program is called. +See gitlink:git[7] for details. Performing a three-way merge @@ -183,7 +209,7 @@ Unspecified:: different merge driver to be used for paths to which the `merge` attribute is unspecified. -Any other string value:: +String:: 3-way merge is performed using the specified custom merge driver. The built-in 3-way merge driver can be -- cgit v1.2.3 From b9d14ffbf1f42eb80231d0378dd2f019a162c054 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 24 Apr 2007 13:46:02 -0700 Subject: gitattributes documentation: clarify overriding Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d2edb9b14a..857d55a409 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -49,10 +49,12 @@ Set to a value:: Unspecified:: No glob pattern matches the path, and nothing says if - the path has or does not have the attribute. + 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 -overrides an earlier line. +overrides an earlier line. This overriding is done per +attribute. When deciding what attributes are assigned to a path, git consults `$GIT_DIR/info/attributes` file (which has the highest @@ -215,7 +217,7 @@ String:: merge driver. The built-in 3-way merge driver can be explicitly specified by asking for "text" driver; the built-in "take the current branch" driver can be - requested by "binary". + requested with "binary". Defining a custom merge driver -- cgit v1.2.3 From 3fed15f568c24ec00ef78fddc6cbb881fbbb0277 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 21 Apr 2007 19:09:02 -0700 Subject: Add 'ident' conversion. The 'ident' attribute set to path squashes "$ident:$" to "$ident$" upon checkin, and expands it to "$ident: $" upon checkout. As we have two conversions that affect checkin/checkout paths, clarify how they interact with each other. Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 857d55a409..b6f90f6f37 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -78,12 +78,17 @@ are attributes-aware. Checking-out and checking-in ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The attribute `crlf` affects how the contents stored in the +These attributes affect how the contents stored in the repository are copied to the working tree files when commands -such as `git checkout` and `git merge` run. It also affects how +such as `git checkout` and `git merge` run. They also affect how git stores the contents you prepare in the working tree in the repository upon `git add` and `git commit`. +`crlf` +^^^^^^ + +This attribute controls the line-ending convention. + Set:: Setting the `crlf` attribute on a path is meant to mark @@ -129,6 +134,28 @@ converted to LF upon checkin, but there is no conversion done upon checkout. +`ident` +^^^^^^^ + +When the attribute `ident` is set to a path, git replaces +`$ident$` in the blob object with `$ident:`, followed by +40-character hexadecimal blob object name, followed by a dollar +sign `$` upon checkout. Any byte sequence that begins with +`$ident:` and ends with `$` in the worktree file is replaced +with `$ident$` upon check-in. + + +Interaction between checkin/checkout attributes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In the check-in codepath, the worktree file is first converted +with `ident` (if specified), and then with `crlf` (again, if +specified and applicable). + +In the check-out codepath, the blob content is first converted +with `crlf`, and then `ident`. + + Generating diff text ~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From aa4ed402c9721170fde2e9e43c3825562070e65e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 21 Apr 2007 03:14:13 -0700 Subject: Add 'filter' attribute and external filter driver definition. The interface is similar to the custom low-level merge drivers. First you configure your filter driver by defining 'filter..*' variables in the configuration. filter..clean filter command to run upon checkin filter..smudge filter command to run upon checkout Then you assign filter attribute to each path, whose name matches the custom filter driver's name. Example: (in .gitattributes) *.c filter=indent (in config) [filter "indent"] clean = indent smudge = cat Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index b6f90f6f37..87723105d1 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -156,6 +156,45 @@ In the check-out codepath, the blob content is first converted with `crlf`, and then `ident`. +`filter` +^^^^^^^^ + +A `filter` attribute can be set to a string value. This names +filter driver specified in the configuration. + +A filter driver consists of `clean` command and `smudge` +command, either of which can be left unspecified. Upon +checkout, when `smudge` command is specified, the command is fed +the blob object from its standard input, and its standard output +is used to update the worktree file. Similarly, `clean` command +is used to convert the contents of worktree file upon checkin. + +Missing filter driver definition in the config is not an error +but makes the filter a no-op passthru. + +The content filtering is done to massage the content into a +shape that is more convenient for the platform, filesystem, and +the user to use. The keyword here is "more convenient" and not +"turning something unusable into usable". In other words, it is +"hanging yourself because we gave you a long rope" if your +project uses filtering mechanism in such a way that it makes +your project unusable unless the checkout is done with a +specific filter in effect. + + +Interaction between checkin/checkout attributes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In the check-in codepath, the worktree file is first converted +with `filter` driver (if specified and corresponding driver +defined), then the result is processed with `ident` (if +specified), and then finally with `crlf` (again, if specified +and applicable). + +In the check-out codepath, the blob content is first converted +with `crlf`, and then `ident` and fed to `filter`. + + Generating diff text ~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From af9b54bb2cb0e15780bf3e820b5f1ce399deb2c4 Mon Sep 17 00:00:00 2001 From: Andy Parkins Date: Mon, 14 May 2007 14:37:25 +0100 Subject: Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with other VCSs $Id$ is present already in SVN and CVS; it would mean that people converting their existing repositories won't have to make any changes to the source files should they want to make use of the ident attribute. Given that it's a feature that's meant to calm those very people, it seems obtuse to make them edit every file just to make use of it. I think that bzr uses $Id$; Mercurial has examples hooks for $Id$; monotone has $Id$ on its wishlist. I can't think of a good reason not to stick with the de-facto standard and call ours $Id$ instead of $ident$. Signed-off-by: Andy Parkins Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 87723105d1..d3ac9c7181 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -138,11 +138,11 @@ upon checkout. ^^^^^^^ When the attribute `ident` is set to a path, git replaces -`$ident$` in the blob object with `$ident:`, followed by +`$Id$` in the blob object with `$Id:`, followed by 40-character hexadecimal blob object name, followed by a dollar sign `$` upon checkout. Any byte sequence that begins with -`$ident:` and ends with `$` in the worktree file is replaced -with `$ident$` upon check-in. +`$Id:` and ends with `$` in the worktree file is replaced +with `$Id$` upon check-in. Interaction between checkin/checkout attributes -- cgit v1.2.3 From ae7aa49914072b9007ba62245e68b8bbd24f964a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 8 Jul 2007 17:15:09 -0700 Subject: Document custom hunk header selection Since the external interface seems to have stabilized for this new feature, let's document it properly. Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 55 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d3ac9c7181..810df07217 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -72,8 +72,8 @@ EFFECTS ------- Certain operations by git can be influenced by assigning -particular attributes to a path. Currently, three operations -are attributes-aware. +particular attributes to a path. Currently, the following +operations are attributes-aware. Checking-out and checking-in ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -199,7 +199,9 @@ Generating diff text ~~~~~~~~~~~~~~~~~~~~ The attribute `diff` affects if `git diff` generates textual -patch for the path or just says `Binary files differ`. +patch for the path or just says `Binary files differ`. It also +can affect what line is shown on the hunk header `@@ -k,l +n,m @@` +line. Set:: @@ -224,7 +226,8 @@ String:: Diff is shown using the specified custom diff driver. The driver program is given its input using the same calling convention as used for GIT_EXTERNAL_DIFF - program. + program. This name is also used for custom hunk header + selection. Defining a custom diff driver @@ -249,6 +252,50 @@ parameters, just like `GIT_EXTERNAL_DIFF` program is called. See gitlink:git[7] for details. +Defining a custom hunk-header +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Each group of changes (called "hunk") in the textual diff output +is prefixed with a line of the form: + + @@ -k,l +n,m @@ TEXT + +The text is called 'hunk header', and by default a line that +begins with an alphabet, an underscore or a dollar sign is used, +which matches what GNU `diff -p` output uses. This default +selection however is not suited for some contents, and you can +use customized pattern to make a selection. + +First in .gitattributes, you would assign the `diff` attribute +for paths. + +------------------------ +*.tex diff=tex +------------------------ + +Then, you would define "diff.tex.funcname" configuration to +specify a regular expression that matches a line that you would +want to appear as the hunk header, like this: + +------------------------ +[diff "tex"] + funcname = "^\\(\\\\\\(sub\\)*section{.*\\)$" +------------------------ + +Note. A single level of backslashes are eaten by the +configuration file parser, so you would need to double the +backslashes; the pattern above picks a line that begins with a +backslash, and zero or more occurences of `sub` followed by +`section` followed by open brace, to the end of line. + +There are a few built-in patterns to make this easier, and `tex` +is one of them, so you do not have to write the above in your +configuration file (you still need to enable this with the +attribute mechanism, via `.gitattributes`). Another built-in +pattern is defined for `java` that defines a pattern suitable +for program text in Java language. + + Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 5c759f96d020d7021a7e674c8d1e5bebd17dcd2f Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sun, 29 Jul 2007 22:50:24 -0300 Subject: Documentation/gitattributes.txt: typofix The file used for per-repository attribute setting is not $GIT_DIR/info/gitattributes, but $GIT_DIR/info/attributes. Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 810df07217..8b90a5b980 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -405,7 +405,7 @@ the attributes given to path `t/abc` are computed as follows: and `bar` attributes should be given to this path, so it leaves `foo` and `bar` unset. Attribute `baz` is set. -3. Finally it examines `$GIT_DIR/info/gitattributes`. This file +3. Finally it examines `$GIT_DIR/info/attributes`. This file is used to override the in-tree settings. The first line is a match, and `foo` is set, `bar` is reverted to unspecified state, and `baz` is unset. -- cgit v1.2.3 From 027830755d2972ab2201c53922ce402862a2bd80 Mon Sep 17 00:00:00 2001 From: Brian Hetro Date: Thu, 23 Aug 2007 20:44:13 -0400 Subject: Documentation: Correct various misspellings and typos. Fix minor typos throughout the documentation. Signed-off-by: Brian Hetro Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 8b90a5b980..46f9d591aa 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -285,7 +285,7 @@ want to appear as the hunk header, like this: Note. A single level of backslashes are eaten by the configuration file parser, so you would need to double the backslashes; the pattern above picks a line that begins with a -backslash, and zero or more occurences of `sub` followed by +backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. There are a few built-in patterns to make this easier, and `tex` @@ -394,7 +394,7 @@ abc -foo -bar the attributes given to path `t/abc` are computed as follows: 1. By examining `t/.gitattributes` (which is in the same - diretory as the path in question), git finds that the first + directory as the path in question), git finds that the first line matches. `merge` attribute is set. It also finds that the second line matches, and attributes `foo` and `bar` are unset. @@ -410,7 +410,7 @@ the attributes given to path `t/abc` are computed as follows: a match, and `foo` is set, `bar` is reverted to unspecified state, and `baz` is unset. -As the result, the attributes assignement to `t/abc` becomes: +As the result, the attributes assignment to `t/abc` becomes: ---------------------------------------------------------------- foo set to true -- cgit v1.2.3 From 8460b2fcd45668d91567c36a22ea4f1b14ba133d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 3 Sep 2007 20:07:01 +0200 Subject: archive: specfile support (--pretty=format: in archive files) Add support for a new attribute, specfile. Files marked as being specfiles are expanded by git-archive when they are written to an archive. It has no effect on worktree files. The same placeholders as those for the option --pretty=format: of git-log et al. can be used. The attribute is useful for creating auto-updating specfiles. It is limited by the underlying function format_commit_message(), though. E.g. currently there is no placeholder for git-describe like output, and expanded specfiles can't contain NUL bytes. That can be fixed in format_commit_message() later and will then benefit users of git-log, too. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 46f9d591aa..47a621b733 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -421,6 +421,20 @@ frotz unspecified ---------------------------------------------------------------- +Creating an archive +~~~~~~~~~~~~~~~~~~~ + +`specfile` +^^^^^^^^^^ + +If the attribute `specfile` is set for a file then git will expand +several placeholders when adding this file to an archive. The +expansion depends on the availability of a commit ID, i.e. if +gitlink:git-archive[1] has been given a tree instead of a commit or a +tag then no replacement will be done. The placeholders are the same +as those for the option `--pretty=format:` of gitlink:git-log[1]. + + GIT --- Part of the gitlink:git[7] suite -- cgit v1.2.3 From df4a394f91d7d107c2a57e6c1df3638517cab54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Fri, 7 Sep 2007 00:34:06 +0200 Subject: archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" (take 2) As suggested by Johannes, --pretty=format: placeholders in specfiles need to be wrapped in $Format:...$ now. This syntax change restricts the expansion of placeholders and makes it easier to use with files that contain non-placeholder percent signs. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 47a621b733..37b3be8b72 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -432,7 +432,10 @@ several placeholders when adding this file to an archive. The expansion depends on the availability of a commit ID, i.e. if gitlink:git-archive[1] has been given a tree instead of a commit or a tag then no replacement will be done. The placeholders are the same -as those for the option `--pretty=format:` of gitlink:git-log[1]. +as those for the option `--pretty=format:` of gitlink:git-log[1], +except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` +in the file. E.g. the string `$Format:%H$` will be replaced by the +commit hash. GIT -- cgit v1.2.3 From 38c9c9b798a0df875968ae49d699298131dfa24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 6 Sep 2007 18:51:11 +0200 Subject: archive: rename attribute specfile to export-subst As suggested by Junio and Johannes, change the name of the former attribute specfile to export-subst to indicate its function rather than purpose and to make clear that it is not applied to working tree files. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 37b3be8b72..d0e951ee6f 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -424,10 +424,10 @@ frotz unspecified Creating an archive ~~~~~~~~~~~~~~~~~~~ -`specfile` -^^^^^^^^^^ +`export-subst` +^^^^^^^^^^^^^^ -If the attribute `specfile` is set for a file then git will expand +If the attribute `export-subst` is set for a file then git will expand several placeholders when adding this file to an archive. The expansion depends on the availability of a commit ID, i.e. if gitlink:git-archive[1] has been given a tree instead of a commit or a -- cgit v1.2.3 From 2dbbc45730cd85e311a1bff38a07148a423a4f1e Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 25 Sep 2007 15:05:28 +0200 Subject: gitattributes.txt: Remove a duplicated paragraph about 'ident' and 'crlf' interaction. The order in which 'ident' and 'crlf' are carried out is documented a few paragraphs later again, after 'filter' was introduced. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 46f9d591aa..676f694f82 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -145,17 +145,6 @@ sign `$` upon checkout. Any byte sequence that begins with with `$Id$` upon check-in. -Interaction between checkin/checkout attributes -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In the check-in codepath, the worktree file is first converted -with `ident` (if specified), and then with `crlf` (again, if -specified and applicable). - -In the check-out codepath, the blob content is first converted -with `crlf`, and then `ident`. - - `filter` ^^^^^^^^ -- cgit v1.2.3 From 4d84aff356d9c6d86a8d621ee577283ed70e145e Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 25 Sep 2007 15:05:29 +0200 Subject: gitattributes.txt: Be more to the point in the filter driver description. The description was meant to emphasizes that the project should remain usable even if the filter driver was not used. This makes it more explicit and removes the "here is rope to hang yourself" paraphrase. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 676f694f82..dd51aa11ea 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -164,11 +164,10 @@ but makes the filter a no-op passthru. The content filtering is done to massage the content into a shape that is more convenient for the platform, filesystem, and the user to use. The keyword here is "more convenient" and not -"turning something unusable into usable". In other words, it is -"hanging yourself because we gave you a long rope" if your -project uses filtering mechanism in such a way that it makes -your project unusable unless the checkout is done with a -specific filter in effect. +"turning something unusable into usable". In other words, the +intent is that if someone unsets the filter driver definition, +or does not have the appropriate filter program, the project +should still be usable. Interaction between checkin/checkout attributes -- cgit v1.2.3 From c05ef93879696638406cad5be54be577a2666d04 Mon Sep 17 00:00:00 2001 From: Wincent Colaiuta Date: Wed, 14 Nov 2007 08:51:41 +0100 Subject: Grammar fixes for gitattributes documentation Tweak the "filter" section of the gitattributes documentation to add some missing articles and improve some word choices without changing the semantics of the section. Signed-off-by: Wincent Colaiuta Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index dd51aa11ea..cf4ee2ebe5 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -148,22 +148,23 @@ with `$Id$` upon check-in. `filter` ^^^^^^^^ -A `filter` attribute can be set to a string value. This names +A `filter` attribute can be set to a string value that names a filter driver specified in the configuration. -A filter driver consists of `clean` command and `smudge` +A filter driver consists of a `clean` command and a `smudge` command, either of which can be left unspecified. Upon -checkout, when `smudge` command is specified, the command is fed -the blob object from its standard input, and its standard output -is used to update the worktree file. Similarly, `clean` command -is used to convert the contents of worktree file upon checkin. +checkout, when the `smudge` command is specified, the command is +fed the blob object from its standard input, and its standard +output is used to update the worktree file. Similarly, the +`clean` command is used to convert the contents of worktree file +upon checkin. -Missing filter driver definition in the config is not an error +A missing filter driver definition in the config is not an error but makes the filter a no-op passthru. The content filtering is done to massage the content into a shape that is more convenient for the platform, filesystem, and -the user to use. The keyword here is "more convenient" and not +the user to use. The key phrase here is "more convenient" and not "turning something unusable into usable". In other words, the intent is that if someone unsets the filter driver definition, or does not have the appropriate filter program, the project -- cgit v1.2.3 From cf1b7869f0c571bbd4f72a4355d9aca558baa0da Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 6 Dec 2007 00:14:14 -0800 Subject: Use gitattributes to define per-path whitespace rule The `core.whitespace` configuration variable allows you to define what `diff` and `apply` should consider whitespace errors for all paths in the project (See gitlink:git-config[1]). This attribute gives you finer control per path. For example, if you have these in the .gitattributes: frotz whitespace nitfol -whitespace xyzzy whitespace=-trailing all types of whitespace problems known to git are noticed in path 'frotz' (i.e. diff shows them in diff.whitespace color, and apply warns about them), no whitespace problem is noticed in path 'nitfol', and the default types of whitespace problems except "trailing whitespace" are noticed for path 'xyzzy'. A project with mixed Python and C might want to have: *.c whitespace *.py whitespace=-indent-with-non-tab in its toplevel .gitattributes file. Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 20cf8ff816..c4bcbb9358 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -360,6 +360,37 @@ When left unspecified, the driver itself is used for both internal merge and the final merge. +Checking whitespace errors +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`whitespace` +^^^^^^^^^^^^ + +The `core.whitespace` configuration variable allows you to define what +`diff` and `apply` should consider whitespace errors for all paths in +the project (See gitlink:git-config[1]). This attribute gives you finer +control per path. + +Set:: + + Notice all types of potential whitespace errors known to git. + +Unset:: + + Do not notice anything as error. + +Unspecified:: + + Use the value of `core.whitespace` configuration variable to + decide what to notice as error. + +String:: + + Specify a comma separate list of common whitespace problems to + notice in the same format as `core.whitespace` configuration + variable. + + EXAMPLE ------- -- cgit v1.2.3 From 0e545f75169e2c260dfb4445203c23cafdfc76ef Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 22 Dec 2007 23:14:59 -0800 Subject: Documentation: describe 'union' low-level merge driver Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 71c7ad76d5..cc9c7c52c0 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -322,12 +322,43 @@ String:: requested with "binary". +Built-in merge drivers +^^^^^^^^^^^^^^^^^^^^^^ + +There are a few built-in low-level merge drivers defined that +can be asked for via the `merge` attribute. + +text:: + + Usual 3-way file level merge for text files. Conflicted + regions are marked with conflict markers `<<<<<<<`, + `=======` and `>>>>>>>`. The version from your branch + appears before the `=======` marker, and the version + from the merged branch appears after the `=======` + marker. + +binary:: + + Keep the version from your branch in the work tree, but + leave the path in the conflicted state for the user to + sort out. + +union:: + + Run 3-way file level merge for text files, but take + lines from both versions, instead of leaving conflict + markers. This tends to leave the added lines in the + resulting file in random order and the user should + verify the result. Do not use this if you do not + understand the implications. + + Defining a custom merge driver ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The definition of a merge driver is done in `gitconfig` not -`gitattributes` file, so strictly speaking this manual page is a -wrong place to talk about it. However... +The definition of a merge driver is done in the `.git/config` +file, not in the `gitattributes` file, so strictly speaking this +manual page is a wrong place to talk about it. However... To define a custom merge driver `filfre`, add a section to your `$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this: -- cgit v1.2.3 From 5162e69732d13dd079919a389a6ace8878aad716 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 29 Dec 2007 00:20:38 -0600 Subject: Documentation: rename gitlink macro to linkgit Between AsciiDoc 8.2.2 and 8.2.3, the following change was made to the stock Asciidoc configuration: @@ -149,7 +153,10 @@ # Inline macros. # Backslash prefix required for escape processing. # (?s) re flag for line spanning. -(?su)[\\]?(?P\w(\w|-)*?):(?P\S*?)(\[(?P.*?)\])= + +# Explicit so they can be nested. +(?su)[\\]?(?P(http|https|ftp|file|mailto|callto|image|link)):(?P\S*?)(\[(?P.*?)\])= + # Anchor: [[[id]]]. Bibliographic anchor. (?su)[\\]?\[\[\[(?P[\w][\w-]*?)\]\]\]=anchor3 # Anchor: [[id,xreflabel]] This default regex now matches explicit values, and unfortunately in this case gitlink was being matched by just 'link', causing the wrong inline macro template to be applied. By renaming the macro, we can avoid being matched by the wrong regex. Signed-off-by: Dan McGee Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index cc9c7c52c0..35a29fd60c 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -238,7 +238,7 @@ When git needs to show you a diff for the path with `diff` attribute set to `jcdiff`, it calls the command you specified with the above configuration, i.e. `j-c-diff`, with 7 parameters, just like `GIT_EXTERNAL_DIFF` program is called. -See gitlink:git[7] for details. +See linkgit:git[7] for details. Defining a custom hunk-header @@ -400,7 +400,7 @@ Checking whitespace errors The `core.whitespace` configuration variable allows you to define what `diff` and `apply` should consider whitespace errors for all paths in -the project (See gitlink:git-config[1]). This attribute gives you finer +the project (See linkgit:git-config[1]). This attribute gives you finer control per path. Set:: @@ -481,9 +481,9 @@ Creating an archive If the attribute `export-subst` is set for a file then git will expand several placeholders when adding this file to an archive. The expansion depends on the availability of a commit ID, i.e. if -gitlink:git-archive[1] has been given a tree instead of a commit or a +linkgit:git-archive[1] has been given a tree instead of a commit or a tag then no replacement will be done. The placeholders are the same -as those for the option `--pretty=format:` of gitlink:git-log[1], +as those for the option `--pretty=format:` of linkgit:git-log[1], except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` in the file. E.g. the string `$Format:%H$` will be replaced by the commit hash. @@ -491,4 +491,4 @@ commit hash. GIT --- -Part of the gitlink:git[7] suite +Part of the linkgit:git[7] suite -- cgit v1.2.3 From 21e5ad50fc5e7277c74cfbb3cf6502468e840f86 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Wed, 6 Feb 2008 12:25:58 +0100 Subject: safecrlf: Add mechanism to warn about irreversible crlf conversions CRLF conversion bears a slight chance of corrupting data. autocrlf=true will convert CRLF to LF during commit and LF to CRLF during checkout. A file that contains a mixture of LF and CRLF before the commit cannot be recreated by git. For text files this is the right thing to do: it corrects line endings such that we have only LF line endings in the repository. But for binary files that are accidentally classified as text the conversion can corrupt data. If you recognize such corruption early you can easily fix it by setting the conversion type explicitly in .gitattributes. Right after committing you still have the original file in your work tree and this file is not yet corrupted. You can explicitly tell git that this file is binary and git will handle the file appropriately. Unfortunately, the desired effect of cleaning up text files with mixed line endings and the undesired effect of corrupting binary files cannot be distinguished. In both cases CRLFs are removed in an irreversible way. For text files this is the right thing to do because CRLFs are line endings, while for binary files converting CRLFs corrupts data. This patch adds a mechanism that can either warn the user about an irreversible conversion or can even refuse to convert. The mechanism is controlled by the variable core.safecrlf, with the following values: - false: disable safecrlf mechanism - warn: warn about irreversible conversions - true: refuse irreversible conversions The default is to warn. Users are only affected by this default if core.autocrlf is set. But the current default of git is to leave core.autocrlf unset, so users will not see warnings unless they deliberately chose to activate the autocrlf mechanism. The safecrlf mechanism's details depend on the git command. The general principles when safecrlf is active (not false) are: - we warn/error out if files in the work tree can modified in an irreversible way without giving the user a chance to backup the original file. - for read-only operations that do not modify files in the work tree we do not not print annoying warnings. There are exceptions. Even though... - "git add" itself does not touch the files in the work tree, the next checkout would, so the safety triggers; - "git apply" to update a text file with a patch does touch the files in the work tree, but the operation is about text files and CRLF conversion is about fixing the line ending inconsistencies, so the safety does not trigger; - "git diff" itself does not touch the files in the work tree, it is often run to inspect the changes you intend to next "git add". To catch potential problems early, safety triggers. The concept of a safety check was originally proposed in a similar way by Linus Torvalds. Thanks to Dimitry Potapov for insisting on getting the naked LF/autocrlf=true case right. Signed-off-by: Steffen Prohaska --- Documentation/gitattributes.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 35a29fd60c..84ec9623a2 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -133,6 +133,26 @@ When `core.autocrlf` is set to "input", line endings are converted to LF upon checkin, but there is no conversion done upon checkout. +If `core.safecrlf` is set to "true" or "warn", git verifies if +the conversion is reversible for the current setting of +`core.autocrlf`. For "true", git rejects irreversible +conversions; for "warn", git only prints a warning but accepts +an irreversible conversion. The safety triggers to prevent such +a conversion done to the files in the work tree, but there are a +few exceptions. Even though... + +- "git add" itself does not touch the files in the work tree, the + next checkout would, so the safety triggers; + +- "git apply" to update a text file with a patch does touch the files + in the work tree, but the operation is about text files and CRLF + conversion is about fixing the line ending inconsistencies, so the + safety does not trigger; + +- "git diff" itself does not touch the files in the work tree, it is + often run to inspect the changes you intend to next "git add". To + catch potential problems early, safety triggers. + `ident` ^^^^^^^ -- cgit v1.2.3 From 90b22907f2d1e0b41d7ac5c281ed20e7c8a27c66 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 27 Mar 2008 01:31:00 -0400 Subject: Documentation: clarify use of .git{ignore,attributes} versus .git/info/* gitignore patterns can be read from three different files, while gitattributes can come from two files. Let's provide some hints to the user about the differences and how they are typically used. Suggested by Toby Corkindale, but gratuitously reworded by Jeff King. Signed-off-by: Toby Corkindale Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 35a29fd60c..970db0c732 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -63,6 +63,13 @@ path in question, and its parent directories (the further the directory that contains `.gitattributes` is from the path in question, the lower its precedence). +If you wish to affect only a single repository (i.e., to assign +attributes to files that are particular to one user's workflow), then +attributes should be placed in the `$GIT_DIR/info/attributes` file. +Attributes which should be version-controlled and distributed to other +repositories (i.e., attributes of interest to all users) should go into +`.gitattributes` files. + Sometimes you would need to override an setting of an attribute for a path to `unspecified` state. This can be done by listing the name of the attribute prefixed with an exclamation point `!`. -- cgit v1.2.3 From 9e1f0a85c68323830ea117092c55192b17aa3ac8 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 6 Jun 2008 09:07:32 +0200 Subject: documentation: move git(7) to git(1) As the "git" man page describes the "git" command at the end-user level, it seems better to move it to man section 1. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 04ca63ca3d..471754eb12 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -265,7 +265,7 @@ When git needs to show you a diff for the path with `diff` attribute set to `jcdiff`, it calls the command you specified with the above configuration, i.e. `j-c-diff`, with 7 parameters, just like `GIT_EXTERNAL_DIFF` program is called. -See linkgit:git[7] for details. +See linkgit:git[1] for details. Defining a custom hunk-header @@ -518,4 +518,4 @@ commit hash. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite -- cgit v1.2.3 From 008d896df5deaa967d4d86306b408333e8ef34c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 8 Jun 2008 18:42:33 +0200 Subject: Teach new attribute 'export-ignore' to git-archive Paths marked with this attribute are not output to git-archive output. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 471754eb12..6e67990f64 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -502,6 +502,12 @@ frotz unspecified Creating an archive ~~~~~~~~~~~~~~~~~~~ +`export-ignore` +^^^^^^^^^^^^^^^ + +Files and directories with the attribute `export-ignore` won't be added to +archive files. + `export-subst` ^^^^^^^^^^^^^^ -- cgit v1.2.3 From b1889c36d85514e5e70462294c561a02c2edfe2b Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 30 Jun 2008 01:09:04 -0500 Subject: Documentation: be consistent about "git-" versus "git " Since the git-* commands are not installed in $(bindir), using "git-command " in examples in the documentation is not a good idea. On the other hand, it is nice to be able to refer to each command using one hyphenated word. (There is no escaping it, anyway: man page names cannot have spaces in them.) This patch retains the dash in naming an operation, command, program, process, or action. Complete command lines that can be entered at a shell (i.e., without options omitted) are made to use the dashless form. The changes consist only of replacing some spaces with hyphens and vice versa. After a "s/ /-/g", the unpatched and patched versions are identical. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 6e67990f64..e96d3cdcac 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -87,9 +87,9 @@ Checking-out and checking-in These attributes affect how the contents stored in the repository are copied to the working tree files when commands -such as `git checkout` and `git merge` run. They also affect how +such as `git-checkout` and `git-merge` run. They also affect how git stores the contents you prepare in the working tree in the -repository upon `git add` and `git commit`. +repository upon `git-add` and `git-commit`. `crlf` ^^^^^^ @@ -148,16 +148,16 @@ an irreversible conversion. The safety triggers to prevent such a conversion done to the files in the work tree, but there are a few exceptions. Even though... -- "git add" itself does not touch the files in the work tree, the +- "git-add" itself does not touch the files in the work tree, the next checkout would, so the safety triggers; -- "git apply" to update a text file with a patch does touch the files +- "git-apply" to update a text file with a patch does touch the files in the work tree, but the operation is about text files and CRLF conversion is about fixing the line ending inconsistencies, so the safety does not trigger; -- "git diff" itself does not touch the files in the work tree, it is - often run to inspect the changes you intend to next "git add". To +- "git-diff" itself does not touch the files in the work tree, it is + often run to inspect the changes you intend to next "git-add". To catch potential problems early, safety triggers. @@ -214,7 +214,7 @@ with `crlf`, and then `ident` and fed to `filter`. Generating diff text ~~~~~~~~~~~~~~~~~~~~ -The attribute `diff` affects if `git diff` generates textual +The attribute `diff` affects if `git-diff` generates textual patch for the path or just says `Binary files differ`. It also can affect what line is shown on the hunk header `@@ -k,l +n,m @@` line. -- cgit v1.2.3 From 483bc4f045881b998512ae814d6cf44d0c0cb493 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 30 Jun 2008 13:56:34 -0500 Subject: Documentation formatting and cleanup Following what appears to be the predominant style, format names of commands and commandlines both as `teletype text`. While we're at it, add articles ("a" and "the") in some places, italicize the name of the command in the manual page synopsis line, and add a comma or two where it seems appropriate. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index e96d3cdcac..124170a967 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -148,16 +148,16 @@ an irreversible conversion. The safety triggers to prevent such a conversion done to the files in the work tree, but there are a few exceptions. Even though... -- "git-add" itself does not touch the files in the work tree, the +- `git-add` itself does not touch the files in the work tree, the next checkout would, so the safety triggers; -- "git-apply" to update a text file with a patch does touch the files +- `git-apply` to update a text file with a patch does touch the files in the work tree, but the operation is about text files and CRLF conversion is about fixing the line ending inconsistencies, so the safety does not trigger; -- "git-diff" itself does not touch the files in the work tree, it is - often run to inspect the changes you intend to next "git-add". To +- `git-diff` itself does not touch the files in the work tree, it is + often run to inspect the changes you intend to next `git-add`. To catch potential problems early, safety triggers. @@ -513,8 +513,8 @@ archive files. If the attribute `export-subst` is set for a file then git will expand several placeholders when adding this file to an archive. The -expansion depends on the availability of a commit ID, i.e. if -linkgit:git-archive[1] has been given a tree instead of a commit or a +expansion depends on the availability of a commit ID, i.e., if +`git-archive` has been given a tree instead of a commit or a tag then no replacement will be done. The placeholders are the same as those for the option `--pretty=format:` of linkgit:git-log[1], except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` -- cgit v1.2.3 From ba020ef5eb5fca3d757bd580ff117adaf81ca079 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Thu, 3 Jul 2008 00:41:41 -0500 Subject: manpages: italicize git command names (which were in teletype font) The names of git commands are not meant to be entered at the commandline; they are just names. So we render them in italics, as is usual for command names in manpages. Using doit () { perl -e 'for (<>) { s/\`(git-[^\`.]*)\`/'\''\1'\''/g; print }' } for i in git*.txt config.txt diff*.txt blame*.txt fetch*.txt i18n.txt \ merge*.txt pretty*.txt pull*.txt rev*.txt urls*.txt do doit <"$i" >"$i+" && mv "$i+" "$i" done git diff . Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 124170a967..0b53044411 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -87,9 +87,9 @@ Checking-out and checking-in These attributes affect how the contents stored in the repository are copied to the working tree files when commands -such as `git-checkout` and `git-merge` run. They also affect how +such as 'git-checkout' and 'git-merge' run. They also affect how git stores the contents you prepare in the working tree in the -repository upon `git-add` and `git-commit`. +repository upon 'git-add' and 'git-commit'. `crlf` ^^^^^^ @@ -148,16 +148,16 @@ an irreversible conversion. The safety triggers to prevent such a conversion done to the files in the work tree, but there are a few exceptions. Even though... -- `git-add` itself does not touch the files in the work tree, the +- 'git-add' itself does not touch the files in the work tree, the next checkout would, so the safety triggers; -- `git-apply` to update a text file with a patch does touch the files +- 'git-apply' to update a text file with a patch does touch the files in the work tree, but the operation is about text files and CRLF conversion is about fixing the line ending inconsistencies, so the safety does not trigger; -- `git-diff` itself does not touch the files in the work tree, it is - often run to inspect the changes you intend to next `git-add`. To +- 'git-diff' itself does not touch the files in the work tree, it is + often run to inspect the changes you intend to next 'git-add'. To catch potential problems early, safety triggers. @@ -214,7 +214,7 @@ with `crlf`, and then `ident` and fed to `filter`. Generating diff text ~~~~~~~~~~~~~~~~~~~~ -The attribute `diff` affects if `git-diff` generates textual +The attribute `diff` affects if 'git-diff' generates textual patch for the path or just says `Binary files differ`. It also can affect what line is shown on the hunk header `@@ -k,l +n,m @@` line. @@ -514,7 +514,7 @@ archive files. If the attribute `export-subst` is set for a file then git will expand several placeholders when adding this file to an archive. The expansion depends on the availability of a commit ID, i.e., if -`git-archive` has been given a tree instead of a commit or a +'git-archive' has been given a tree instead of a commit or a tag then no replacement will be done. The placeholders are the same as those for the option `--pretty=format:` of linkgit:git-log[1], except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` -- cgit v1.2.3 From 2fd02c92dbb6e575b7e62ea9dfa85ef45ebe58b6 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Thu, 3 Jul 2008 00:55:07 -0500 Subject: manpages: italicize nongit command names (if they are in teletype font) Some manual pages use teletype font to set command names. We change them to use italics, instead. This creates a visual distinction between names of commands and command lines that can be typed at the command line. It is also more consistent with other man pages outside Git. In this patch, the commands named are non-git commands like bash. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 0b53044411..6a246eb1fc 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -278,7 +278,7 @@ is prefixed with a line of the form: The text is called 'hunk header', and by default a line that begins with an alphabet, an underscore or a dollar sign is used, -which matches what GNU `diff -p` output uses. This default +which matches what GNU 'diff -p' output uses. This default selection however is not suited for some contents, and you can use customized pattern to make a selection. @@ -322,7 +322,7 @@ and other programs such as `git revert` and `git cherry-pick`. Set:: Built-in 3-way merge driver is used to merge the - contents in a way similar to `merge` command of `RCS` + contents in a way similar to 'merge' command of `RCS` suite. This is suitable for ordinary text files. Unset:: @@ -426,7 +426,7 @@ Checking whitespace errors ^^^^^^^^^^^^ The `core.whitespace` configuration variable allows you to define what -`diff` and `apply` should consider whitespace errors for all paths in +'diff' and 'apply' should consider whitespace errors for all paths in the project (See linkgit:git-config[1]). This attribute gives you finer control per path. -- cgit v1.2.3 From 8a33dd8b6e29722e86556c178d7c0b963804f0d3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 5 Jul 2008 18:14:27 -0700 Subject: attribute documentation: keep EXAMPLE at end The document gives overall definition of states in DESCRIPTION, describes various aspects of git operations that can be influenced in EFFECTS, and finally gives examples in the EXAMPLE section. Archive creation however was somehow documented after the EXAMPLE section, not insode EFFECTS. Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 471754eb12..ef06d94ca8 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -450,6 +450,23 @@ String:: variable. +Creating an archive +~~~~~~~~~~~~~~~~~~~ + +`export-subst` +^^^^^^^^^^^^^^ + +If the attribute `export-subst` is set for a file then git will expand +several placeholders when adding this file to an archive. The +expansion depends on the availability of a commit ID, i.e. if +linkgit:git-archive[1] has been given a tree instead of a commit or a +tag then no replacement will be done. The placeholders are the same +as those for the option `--pretty=format:` of linkgit:git-log[1], +except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` +in the file. E.g. the string `$Format:%H$` will be replaced by the +commit hash. + + EXAMPLE ------- @@ -499,22 +516,6 @@ frotz unspecified ---------------------------------------------------------------- -Creating an archive -~~~~~~~~~~~~~~~~~~~ - -`export-subst` -^^^^^^^^^^^^^^ - -If the attribute `export-subst` is set for a file then git will expand -several placeholders when adding this file to an archive. The -expansion depends on the availability of a commit ID, i.e. if -linkgit:git-archive[1] has been given a tree instead of a commit or a -tag then no replacement will be done. The placeholders are the same -as those for the option `--pretty=format:` of linkgit:git-log[1], -except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` -in the file. E.g. the string `$Format:%H$` will be replaced by the -commit hash. - GIT --- -- cgit v1.2.3 From d08ed6d692a79eb2a62410d7e76380fbf25ca793 Mon Sep 17 00:00:00 2001 From: Gustaf Hendeby Date: Tue, 12 Aug 2008 16:24:25 +0200 Subject: gitattributes: Document built in hunk header patterns Since the hunk header pattern text was written patterns for Ruby and Pascal/Delphi have been added. For users to be able to find them they should be documented not only in code. Signed-off-by: Gustaf Hendeby Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d7b41142d2..c61a58d8f2 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -307,9 +307,16 @@ backslash, and zero or more occurrences of `sub` followed by There are a few built-in patterns to make this easier, and `tex` is one of them, so you do not have to write the above in your configuration file (you still need to enable this with the -attribute mechanism, via `.gitattributes`). Another built-in -pattern is defined for `java` that defines a pattern suitable -for program text in Java language. +attribute mechanism, via `.gitattributes`). The following built in +patterns are available: + +- `java` suitable for source code in the Java lanugage. + +- `pascal` suitable for source code in the Pascal/Delphi language. + +- `ruby` suitable for source code in the Ruby language. + +- `tex` suitable for source code for LaTeX documents. Performing a three-way merge -- cgit v1.2.3 From 23b5beb28fdadbb1d80ebf686a35385609f7a180 Mon Sep 17 00:00:00 2001 From: Gustaf Hendeby Date: Tue, 12 Aug 2008 16:24:26 +0200 Subject: Teach git diff about BibTeX head hunk patterns All BibTeX entries starts with an @ followed by an entry type. Since there are many entry types and own can be defined, the pattern matches legal entry type names instead of just the default types (which would be a long list). The pattern also matches strings and comments since they will also be useful to position oneself in a bib-file. Signed-off-by: Gustaf Hendeby Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index c61a58d8f2..db16b0ca5b 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -310,6 +310,8 @@ configuration file (you still need to enable this with the attribute mechanism, via `.gitattributes`). The following built in patterns are available: +- `bibtex` suitable for files with BibTeX coded references. + - `java` suitable for source code in the Java lanugage. - `pascal` suitable for source code in the Pascal/Delphi language. -- cgit v1.2.3 From 7c17205b64a0e668d8a6e59109043bd4f2af3a0c Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Wed, 20 Aug 2008 19:57:07 +0400 Subject: Teach "git diff -p" Python funcname patterns Find classes, functions, and methods definitions. Signed-off-by: Kirill Smelkov Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index db16b0ca5b..9279df5349 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -316,6 +316,8 @@ patterns are available: - `pascal` suitable for source code in the Pascal/Delphi language. +- `python` suitable for source code in the Python language. + - `ruby` suitable for source code in the Ruby language. - `tex` suitable for source code for LaTeX documents. -- cgit v1.2.3 From 1a1fcf4abeb2ed4ef6075970788711cf62405158 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Wed, 20 Aug 2008 19:49:15 +0200 Subject: Teach "git diff -p" HTML funcname patterns Find lines with

..

tags. [jc: while at it, reordered entries to sort alphabetically.] Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 9279df5349..5495d695c6 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -322,6 +322,8 @@ patterns are available: - `tex` suitable for source code for LaTeX documents. +- `html` suitable for HTML/XHTML documents. + Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From bbb896d8e10f736bfda8f587c0009c358c9a8599 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 30 Aug 2008 14:35:15 -0700 Subject: gitattributes: -crlf is not binary The description of crlf attribute incorrectly said that "-crlf" means binary. It is true that for binary files you would want "-crlf", but that is not the same thing. We also have supported attribute macros and via that mechanism a handy "binary" to specify "-crlf -diff" at the same time. It was not documented anywhere as far as I can tell, even though the support was there from the very beginning. Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index db16b0ca5b..1993887937 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -105,9 +105,8 @@ Set:: Unset:: - Unsetting the `crlf` attribute on a path is meant to - mark the path as a "binary" file. The path never goes - through line endings conversion upon checkin/checkout. + Unsetting the `crlf` attribute on a path tells git not to + attempt any end-of-line conversion upon checkin or checkout. Unspecified:: @@ -482,6 +481,41 @@ in the file. E.g. the string `$Format:%H$` will be replaced by the commit hash. +USING ATTRIBUTE MACROS +---------------------- + +You do not want any end-of-line conversions applied to, nor textual diffs +produced for, any binary file you track. You would need to specify e.g. + +------------ +*.jpg -crlf -diff +------------ + +but that may become cumbersome, when you have many attributes. Using +attribute macros, you can specify groups of attributes set or unset at +the same time. The system knows a built-in attribute macro, `binary`: + +------------ +*.jpg binary +------------ + +which is equivalent to the above. Note that the attribute macros can only +be "Set" (see the above example that sets "binary" macro as if it were an +ordinary attribute --- setting it in turn unsets "crlf" and "diff"). + + +DEFINING ATTRIBUTE MACROS +------------------------- + +Custom attribute macros can be defined only in the `.gitattributes` file +at the toplevel (i.e. not in any subdirectory). The built-in attribute +macro "binary" is equivalent to: + +------------ +[attr]binary -diff -crlf +------------ + + EXAMPLE ------- -- cgit v1.2.3 From e5b5c1d2cf0416b0e597c4b974b0efbd1da54267 Mon Sep 17 00:00:00 2001 From: Gustaf Hendeby Date: Sun, 31 Aug 2008 18:00:27 +0200 Subject: Document clarification: gitmodules, gitattributes The SYNOPSIS section of gitattibutes and gitmodule fail to clearly specify the name of the in tree files used. This patch brings in the initial `.' and the fact that the `.gitmodules' file should reside at the top-level of the working tree. Signed-off-by: Gustaf Hendeby Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 1993887937..49a167f241 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -7,7 +7,7 @@ gitattributes - defining attributes per path SYNOPSIS -------- -$GIT_DIR/info/attributes, gitattributes +$GIT_DIR/info/attributes, .gitattributes DESCRIPTION -- cgit v1.2.3 From af9ce1ffc6de9774e90a91f27fb1febd027f74f1 Mon Sep 17 00:00:00 2001 From: Andreas Ericsson Date: Sun, 7 Sep 2008 22:15:29 +0200 Subject: Teach "git diff -p" to locate PHP class methods Otherwise it will always print the class-name rather than the name of the function inside that class. While we're at it, reorder the gitattributes manpage to list the built-in funcname pattern names in alphabetical order. Signed-off-by: Andreas Ericsson Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 5fb5007413..75124d2612 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -311,18 +311,20 @@ patterns are available: - `bibtex` suitable for files with BibTeX coded references. +- `html` suitable for HTML/XHTML documents. + - `java` suitable for source code in the Java lanugage. - `pascal` suitable for source code in the Pascal/Delphi language. +- `php` suitable for source code in the PHP language. + - `python` suitable for source code in the Python language. - `ruby` suitable for source code in the Ruby language. - `tex` suitable for source code for LaTeX documents. -- `html` suitable for HTML/XHTML documents. - Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From b66e00f12a4e0eef7c9f994db5386e066d726778 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Fri, 12 Sep 2008 21:10:26 +0200 Subject: Fix some manual typos. Signed-off-by: Ralf Wildenhues Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 49a167f241..94e6752aa2 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -311,7 +311,7 @@ patterns are available: - `bibtex` suitable for files with BibTeX coded references. -- `java` suitable for source code in the Java lanugage. +- `java` suitable for source code in the Java language. - `pascal` suitable for source code in the Pascal/Delphi language. -- cgit v1.2.3 From c882c01ef9c5a82c1282fd1cb094bb8f97472d7d Mon Sep 17 00:00:00 2001 From: Garry Dolley Date: Tue, 16 Sep 2008 23:20:39 -0700 Subject: Clarified gitattributes documentation regarding custom hunk header. The only part of the hunk header that we can change is the "TEXT" portion. Additionally, a few grammatical errors have been corrected. Signed-off-by: Garry Dolley Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 94e6752aa2..89627688b8 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -270,27 +270,27 @@ See linkgit:git[1] for details. Defining a custom hunk-header ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Each group of changes (called "hunk") in the textual diff output +Each group of changes (called a "hunk") in the textual diff output is prefixed with a line of the form: @@ -k,l +n,m @@ TEXT -The text is called 'hunk header', and by default a line that -begins with an alphabet, an underscore or a dollar sign is used, -which matches what GNU 'diff -p' output uses. This default -selection however is not suited for some contents, and you can -use customized pattern to make a selection. +This is called a 'hunk header'. The "TEXT" portion is by default a line +that begins with an alphabet, an underscore or a dollar sign; this +matches what GNU 'diff -p' output uses. This default selection however +is not suited for some contents, and you can use a customized pattern +to make a selection. -First in .gitattributes, you would assign the `diff` attribute +First, in .gitattributes, you would assign the `diff` attribute for paths. ------------------------ *.tex diff=tex ------------------------ -Then, you would define "diff.tex.funcname" configuration to +Then, you would define a "diff.tex.funcname" configuration to specify a regular expression that matches a line that you would -want to appear as the hunk header, like this: +want to appear as the hunk header "TEXT", like this: ------------------------ [diff "tex"] -- cgit v1.2.3 From 45d9414fa5599b41578625961b53e18a9b9148c7 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 18 Sep 2008 17:44:33 -0500 Subject: diff.*.xfuncname which uses "extended" regex's for hunk header selection Currently, the hunk headers produced by 'diff -p' are customizable by setting the diff.*.funcname option in the config file. The 'funcname' option takes a basic regular expression. This functionality was designed using the GNU regex library which, by default, allows using backslashed versions of some extended regular expression operators, even in Basic Regular Expression mode. For example, the following characters, when backslashed, are interpreted according to the extended regular expression rules: ?, +, and |. As such, the builtin funcname patterns were created using some extended regular expression operators. Other platforms which adhere more strictly to the POSIX spec do not interpret the backslashed extended RE operators in Basic Regular Expression mode. This causes the pattern matching for the builtin funcname patterns to fail on those platforms. Introduce a new option 'xfuncname' which uses extended regular expressions, and advertise it _instead_ of funcname. Since most users are on GNU platforms, the majority of funcname patterns are created and tested there. Advertising only xfuncname should help to avoid the creation of non-portable patterns which work with GNU regex but not elsewhere. Additionally, the extended regular expressions may be less ugly and complicated compared to the basic RE since many common special operators do not need to be backslashed. For example, the GNU Basic RE: ^[ ]*\\(\\(public\\|static\\).*\\)$ becomes the following Extended RE: ^[ ]*((public|static).*)$ Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 94e6752aa2..9259637609 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -288,13 +288,13 @@ for paths. *.tex diff=tex ------------------------ -Then, you would define "diff.tex.funcname" configuration to +Then, you would define "diff.tex.xfuncname" configuration to specify a regular expression that matches a line that you would want to appear as the hunk header, like this: ------------------------ [diff "tex"] - funcname = "^\\(\\\\\\(sub\\)*section{.*\\)$" + xfuncname = "^(\\\\(sub)*section\\{.*)$" ------------------------ Note. A single level of backslashes are eaten by the -- cgit v1.2.3 From 5d1e958e2467ef295637844fd85be7a8ab187ef1 Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Wed, 1 Oct 2008 00:46:34 +0100 Subject: Teach git diff about Objective-C syntax Add support for recognition of Objective-C class & instance methods, C functions, and class implementation/interfaces. Signed-off-by: Jonathan del Strother Signed-off-by: Shawn O. Pearce --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 2ae771f2fb..26945593cb 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -315,6 +315,8 @@ patterns are available: - `java` suitable for source code in the Java language. +- `objc` suitable for source code in the Objective-C language. + - `pascal` suitable for source code in the Pascal/Delphi language. - `php` suitable for source code in the PHP language. -- cgit v1.2.3 From 678852d918e874c99590ba6e857efeef974a3fb9 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 26 Oct 2008 00:41:52 -0400 Subject: document the diff driver textconv feature This patch also changes the term "custom diff driver" to "external diff driver"; now that there are more facets of a "custom driver" than just external diffing, it makes sense to refer to the configuration of "diff.foo.*" as the "foo diff driver", with "diff.foo.command" as the "external driver for foo". Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 66 +++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 13 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 26945593cb..314e2d32e5 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -213,10 +213,12 @@ with `crlf`, and then `ident` and fed to `filter`. Generating diff text ~~~~~~~~~~~~~~~~~~~~ -The attribute `diff` affects if 'git-diff' generates textual -patch for the path or just says `Binary files differ`. It also -can affect what line is shown on the hunk header `@@ -k,l +n,m @@` -line. +The attribute `diff` affects how 'git' generates diffs for particular +files. It can tell git whether to generate a textual patch for the path +or to treat the path as a binary file. It can also affect what line is +shown on the hunk header `@@ -k,l +n,m @@` line, tell git to use an +external command to generate the diff, or ask git to convert binary +files to a text format before generating the diff. Set:: @@ -227,7 +229,8 @@ Set:: Unset:: A path to which the `diff` attribute is unset will - generate `Binary files differ`. + generate `Binary files differ` (or a binary patch, if + binary patches are enabled). Unspecified:: @@ -238,21 +241,21 @@ Unspecified:: String:: - Diff is shown using the specified custom diff driver. - The driver program is given its input using the same - calling convention as used for GIT_EXTERNAL_DIFF - program. This name is also used for custom hunk header - selection. + Diff is shown using the specified diff driver. Each driver may + specify one or more options, as described in the following + section. The options for the diff driver "foo" are defined + by the configuration variables in the "diff.foo" section of the + git config file. -Defining a custom diff driver -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Defining an external diff driver +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The definition of a diff driver is done in `gitconfig`, not `gitattributes` file, so strictly speaking this manual page is a wrong place to talk about it. However... -To define a custom diff driver `jcdiff`, add a section to your +To define an external diff driver `jcdiff`, add a section to your `$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this: ---------------------------------------------------------------- @@ -328,6 +331,43 @@ patterns are available: - `tex` suitable for source code for LaTeX documents. +Performing text diffs of binary files +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Sometimes it is desirable to see the diff of a text-converted +version of some binary files. For example, a word processor +document can be converted to an ASCII text representation, and +the diff of the text shown. Even though this conversion loses +some information, the resulting diff is useful for human +viewing (but cannot be applied directly). + +The `textconv` config option is used to define a program for +performing such a conversion. The program should take a single +argument, the name of a file to convert, and produce the +resulting text on stdout. + +For example, to show the diff of the exif information of a +file instead of the binary information (assuming you have the +exif tool installed): + +------------------------ +[diff "jpg"] + textconv = exif +------------------------ + +NOTE: The text conversion is generally a one-way conversion; +in this example, we lose the actual image contents and focus +just on the text data. This means that diffs generated by +textconv are _not_ suitable for applying. For this reason, +only `git diff` and the `git log` family of commands (i.e., +log, whatchanged, show) will perform text conversion. `git +format-patch` will never generate this output. If you want to +send somebody a text-converted diff of a binary file (e.g., +because it quickly conveys the changes you have made), you +should generate it separately and send it as a comment _in +addition to_ the usual binary diff that you might send. + + Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 2c850f1221efd2441c3794e163ea3918ce31c15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kr=C3=BCger?= Date: Thu, 30 Oct 2008 19:14:33 +0100 Subject: Documentation: clarify information about 'ident' attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation spoke of the attribute being set "to" a path; this can mistakenly be interpreted as "the attribute needs to have its value set to some kind of path". This clarifies things. Signed-off-by: Jan Krüger Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 53da9b4f6b..42776f089b 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -163,8 +163,8 @@ few exceptions. Even though... `ident` ^^^^^^^ -When the attribute `ident` is set to a path, git replaces -`$Id$` in the blob object with `$Id:`, followed by +When the attribute `ident` is set for a path, git replaces +`$Id$` in the blob object with `$Id:`, followed by the 40-character hexadecimal blob object name, followed by a dollar sign `$` upon checkout. Any byte sequence that begins with `$Id:` and ends with `$` in the worktree file is replaced -- cgit v1.2.3 From 4f73e240f98c38e608afe68887639c6e63b1d18f Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sat, 1 Nov 2008 06:24:55 +0000 Subject: Documentation/gitattributes: Add subsection header for each attribute This makes attributes easier to find; before this patch some attributes had individual subsections, and some didn't. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 42776f089b..37fff208ff 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -213,6 +213,9 @@ with `crlf`, and then `ident` and fed to `filter`. Generating diff text ~~~~~~~~~~~~~~~~~~~~ +`diff` +^^^^^^ + The attribute `diff` affects if 'git-diff' generates textual patch for the path or just says `Binary files differ`. It also can affect what line is shown on the hunk header `@@ -k,l +n,m @@` @@ -323,6 +326,9 @@ patterns are available: Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`merge` +^^^^^^^ + The attribute `merge` affects how three versions of a file is merged when a file-level merge is necessary during `git merge`, and other programs such as `git revert` and `git cherry-pick`. -- cgit v1.2.3 From a2df1fb2e52a49bf6b17b352581510efd851f337 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Thu, 13 Nov 2008 20:28:49 +0300 Subject: Documentation: New GUI configuration and command-line options. Add information on new git-gui and gitk command-line options, configuration variables, and the encoding attribute. Signed-off-by: Alexander Gavrilov Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index a172baf993..8af22eccac 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -535,6 +535,23 @@ in the file. E.g. the string `$Format:%H$` will be replaced by the commit hash. +Viewing files in GUI tools +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`encoding` +^^^^^^^^^^ + +The value of this attribute specifies the character encoding that should +be used by GUI tools (e.g. linkgit:gitk[1] and linkgit:git-gui[1]) to +display the contents of the relevant file. Note that due to performance +considerations linkgit:gitk[1] does not use this attribute unless you +manually enable per-file encodings in its options. + +If this attribute is not set or has an invalid value, the value of the +`gui.encoding` configuration variable is used instead +(See linkgit:git-config[1]). + + USING ATTRIBUTE MACROS ---------------------- -- cgit v1.2.3 From 80c49c3de2d5a3aa12b0980a65f1163c8aef0c16 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 17 Jan 2009 17:29:48 +0100 Subject: color-words: make regex configurable via attributes Make the --color-words splitting regular expression configurable via the diff driver's 'wordregex' attribute. The user can then set the driver on a file in .gitattributes. If a regex is given on the command line, it overrides the driver's setting. We also provide built-in regexes for the languages that already had funcname patterns, and add an appropriate diff driver entry for C/++. (The patterns are designed to run UTF-8 sequences into a single chunk to make sure they remain readable.) Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 8af22eccac..ba3ba12730 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -317,6 +317,8 @@ patterns are available: - `bibtex` suitable for files with BibTeX coded references. +- `cpp` suitable for source code in the C and C++ languages. + - `html` suitable for HTML/XHTML documents. - `java` suitable for source code in the Java language. @@ -334,6 +336,25 @@ patterns are available: - `tex` suitable for source code for LaTeX documents. +Customizing word diff +^^^^^^^^^^^^^^^^^^^^^ + +You can customize the rules that `git diff --color-words` uses to +split words in a line, by specifying an appropriate regular expression +in the "diff.*.wordregex" configuration variable. For example, in TeX +a backslash followed by a sequence of letters forms a command, but +several such commands can be run together without intervening +whitespace. To separate them, use a regular expression such as + +------------------------ +[diff "tex"] + wordregex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+" +------------------------ + +A built-in pattern is provided for all languages listed in the +previous section. + + Performing text diffs of binary files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From ae3b970ac3e21324a95fea75213c2569180d74c6 Mon Sep 17 00:00:00 2001 From: Boyd Stephen Smith Jr Date: Tue, 20 Jan 2009 22:59:54 -0600 Subject: Change the spelling of "wordregex". Use "wordRegex" for configuration variable names. Use "word_regex" for C language tokens. Signed-off-by: Boyd Stephen Smith Jr. Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index ba3ba12730..227934f59a 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -341,14 +341,14 @@ Customizing word diff You can customize the rules that `git diff --color-words` uses to split words in a line, by specifying an appropriate regular expression -in the "diff.*.wordregex" configuration variable. For example, in TeX +in the "diff.*.wordRegex" configuration variable. For example, in TeX a backslash followed by a sequence of letters forms a command, but several such commands can be run together without intervening whitespace. To separate them, use a regular expression such as ------------------------ [diff "tex"] - wordregex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+" + wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+" ------------------------ A built-in pattern is provided for all languages listed in the -- cgit v1.2.3 From 3f74c8e8d8721d093655d7bb00ead078d8324100 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 25 Feb 2009 08:54:42 +0100 Subject: gitattributes.txt: Path matching rules are explained in gitignore.txt 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 Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 227934f59a..55668e345f 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -18,10 +18,10 @@ A `gitattributes` file is a simple text file that gives 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 -- cgit v1.2.3 From 20ff3ec28e1dc7b653bfdc7643cb55045d7913fc Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 6 Apr 2009 11:03:36 -0400 Subject: Documentation: clarify .gitattributes search Use the term "toplevel of the work tree" in gitattributes.txt and gitignore.txt to define the limits of the search for those files. Signed-off-by: Jason Merrill Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 37fff208ff..c4aebc4351 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -59,9 +59,9 @@ attribute. 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 (the further the -directory that contains `.gitattributes` is from the path in -question, the lower its precedence). +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). If you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user's workflow), then -- cgit v1.2.3 From c4c86d238900fb8c99939a9b5003fa622d4dcce7 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 16 Apr 2009 03:17:12 -0400 Subject: doc/gitattributes: clarify location of config text The gitattributes documentation has a section on the "diff" attribute, with subsections for each of the things you might want to configure in your diff config section (external diff, hunk headers, etc). The first such subsection specifically notes that the definition of the diff driver should go into $GIT_DIR/config, but subsequent sections do not. This location is implied if you are reading the documentation sequentially, but it is not uncommon for a new user to jump to (or be referred to) a specific section. For a new user who does not know git well enough to recognize the config syntax, it is not clear that those directives don't also go into the gitattributes file. This patch just mentions the config file in each subsection, similar to the way it is mentioned in the first. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index b762bba759..aaa073efc8 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -297,7 +297,8 @@ for paths. Then, you would define a "diff.tex.xfuncname" configuration to specify a regular expression that matches a line that you would -want to appear as the hunk header "TEXT", like this: +want to appear as the hunk header "TEXT". Add a section to your +`$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this: ------------------------ [diff "tex"] @@ -345,7 +346,8 @@ split words in a line, by specifying an appropriate regular expression in the "diff.*.wordRegex" configuration variable. For example, in TeX a backslash followed by a sequence of letters forms a command, but several such commands can be run together without intervening -whitespace. To separate them, use a regular expression such as +whitespace. To separate them, use a regular expression in your +`$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this: ------------------------ [diff "tex"] @@ -373,7 +375,8 @@ resulting text on stdout. For example, to show the diff of the exif information of a file instead of the binary information (assuming you have the -exif tool installed): +exif tool installed), add the following section to your +`$GIT_DIR/config` file (or `$HOME/.gitconfig` file): ------------------------ [diff "jpg"] -- cgit v1.2.3 From 57f6ec029090f64377ec5c0926b6e2e39b0caa4f Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Fri, 7 Aug 2009 17:24:21 +0300 Subject: Change mentions of "git programs" to "git commands" Most of the docs and printouts refer to "commands" when discussing what the end users call via the "git" top-level program. We should refer them as "git programs" when we discuss the fact that the commands are implemented as separate programs, but in other contexts, it is better to use the term "git commands" consistently. Signed-off-by: Ori Avtalion Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index aaa073efc8..1195e83b6e 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -404,7 +404,7 @@ Performing a three-way merge The attribute `merge` affects how three versions of a file is merged when a file-level merge is necessary during `git merge`, -and other programs such as `git revert` and `git cherry-pick`. +and other commands such as `git revert` and `git cherry-pick`. Set:: -- cgit v1.2.3 From 975457f185acd7c1f96ccff67cd5dc8dcb7908a0 Mon Sep 17 00:00:00 2001 From: Nasser Grainawi Date: Wed, 21 Oct 2009 14:06:21 -0700 Subject: Document `delta` attribute in "git help attributes". Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 1195e83b6e..1f472cea59 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -560,6 +560,16 @@ in the file. E.g. the string `$Format:%H$` will be replaced by the commit hash. +Packing objects +~~~~~~~~~~~~~~~ + +`delta` +^^^^^^^ + +Delta compression will not be attempted for blobs for paths with the +attribute `delta` set to false. + + Viewing files in GUI tools ~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From d79f5d17189e70f8a98675a73663113776dcf4fe Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Tue, 15 Dec 2009 12:11:10 +0900 Subject: Illustrate "filter" attribute with an example The example was taken from aa4ed402c9721170fde2e9e43c3825562070e65e (Add 'filter' attribute and external filter driver definition). Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 1f472cea59..5a45e51890 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -197,6 +197,25 @@ intent is that if someone unsets the filter driver definition, or does not have the appropriate filter program, the project should still be usable. +For example, in .gitattributes, you would assign the `filter` +attribute for paths. + +------------------------ +*.c filter=indent +------------------------ + +Then you would define a "filter.indent.clean" and "filter.indent.smudge" +configuration in your .git/config to specify a pair of commands to +modify the contents of C programs when the source files are checked +in ("clean" is run) and checked out (no change is made because the +command is "cat"). + +------------------------ +[filter "indent"] + clean = indent + smudge = cat +------------------------ + Interaction between checkin/checkout attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From 0b444cdb19bcfcc7f59b7b00783cbfbbc5ddcf63 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sun, 10 Jan 2010 00:33:00 +0100 Subject: Documentation: spell 'git cmd' without dash throughout The documentation was quite inconsistent when spelling 'git cmd' if it only refers to the program, not to some specific invocation syntax: both 'git-cmd' and 'git cmd' spellings exist. The current trend goes towards dashless forms, and there is precedent in 647ac70 (git-svn.txt: stop using dash-form of commands., 2009-07-07) to actively eliminate the dashed variants. Replace 'git-cmd' with 'git cmd' throughout, except where git-shell, git-cvsserver, git-upload-pack, git-receive-pack, and git-upload-archive are concerned, because those really live in the $PATH. --- Documentation/gitattributes.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 5a45e51890..814714c56e 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -88,9 +88,9 @@ Checking-out and checking-in These attributes affect how the contents stored in the repository are copied to the working tree files when commands -such as 'git-checkout' and 'git-merge' run. They also affect how +such as 'git checkout' and 'git merge' run. They also affect how git stores the contents you prepare in the working tree in the -repository upon 'git-add' and 'git-commit'. +repository upon 'git add' and 'git commit'. `crlf` ^^^^^^ @@ -148,16 +148,16 @@ an irreversible conversion. The safety triggers to prevent such a conversion done to the files in the work tree, but there are a few exceptions. Even though... -- 'git-add' itself does not touch the files in the work tree, the +- 'git add' itself does not touch the files in the work tree, the next checkout would, so the safety triggers; -- 'git-apply' to update a text file with a patch does touch the files +- 'git apply' to update a text file with a patch does touch the files in the work tree, but the operation is about text files and CRLF conversion is about fixing the line ending inconsistencies, so the safety does not trigger; -- 'git-diff' itself does not touch the files in the work tree, it is - often run to inspect the changes you intend to next 'git-add'. To +- 'git diff' itself does not touch the files in the work tree, it is + often run to inspect the changes you intend to next 'git add'. To catch potential problems early, safety triggers. -- cgit v1.2.3 From 4c734803cbd4fac667ba518460c2c0d8725ae3f7 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 20 Jan 2010 23:49:27 -0800 Subject: conflict-marker-size: add test and docs Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 814714c56e..b396a871b3 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -525,6 +525,23 @@ When left unspecified, the driver itself is used for both internal merge and the final merge. +`conflict-marker-size` +^^^^^^^^^^^^^^^^^^^^^^ + +This attribute controls the length of conflict markers left in +the work tree file during a conflicted merge. Only setting to +the value to a positive integer has any meaningful effect. + +For example, this line in `.gitattributes` can be used to tell the merge +machinery to leave much longer (instead of the usual 7-character-long) +conflict markers when merging the file `Documentation/git-merge.txt` +results in a conflict. + +------------------------ +Documentation/git-merge.txt conflict-marker-size=32 +------------------------ + + Checking whitespace errors ~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 16758621d5a4a78eed7c183b60bf7ebaeaf305c5 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Tue, 23 Feb 2010 21:11:12 +0100 Subject: Documentation: mention conflict marker size argument (%L) for merge driver 23a64c9e (conflict-marker-size: new attribute, 2010-01-16) introduced the new attribute and also pass the conflict marker size as %L to merge driver commands. This documents the substitution. Signed-off-by: Bert Wesarg Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index b396a871b3..d892e642ed 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -511,7 +511,8 @@ command to run to merge ancestor's version (`%O`), current version (`%A`) and the other branches' version (`%B`). These three tokens are replaced with the names of temporary files that hold the contents of these versions when the command line is -built. +built. Additionally, %L will be replaced with the conflict marker +size (see below). The merge driver is expected to leave the result of the merge in the file named with `%A` by overwriting it, and exit with zero -- cgit v1.2.3 From d9bae1a178f0f8b198ea611e874975214ad6f990 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 1 Apr 2010 20:12:15 -0400 Subject: diff: cache textconv output Running a textconv filter can take a long time. It's particularly bad for a large file which needs to be spooled to disk, but even for small files, the fork+exec overhead can add up for something like "git log -p". This patch uses the notes-cache mechanism to keep a fast cache of textconv output. Caches are stored in refs/notes/textconv/$x, where $x is the userdiff driver defined in gitattributes. Caching is enabled only if diff.$x.cachetextconv is true. In my test repo, on a commit with 45 jpg and avi files changed and a textconv to show their exif tags: [before] $ time git show >/dev/null real 0m13.724s user 0m12.057s sys 0m1.624s [after, first run] $ git config diff.mfo.cachetextconv true $ time git show >/dev/null real 0m14.252s user 0m12.197s sys 0m1.800s [after, subsequent runs] $ time git show >/dev/null real 0m0.352s user 0m0.148s sys 0m0.200s So for a slight (3.8%) cost on the first run, we achieve an almost 40x speed up on subsequent runs. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d892e642ed..a8500d1772 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -414,6 +414,26 @@ because it quickly conveys the changes you have made), you should generate it separately and send it as a comment _in addition to_ the usual binary diff that you might send. +Because text conversion can be slow, especially when doing a +large number of them with `git log -p`, git provides a mechanism +to cache the output and use it in future diffs. To enable +caching, set the "cachetextconv" variable in your diff driver's +config. For example: + +------------------------ +[diff "jpg"] + textconv = exif + cachetextconv = true +------------------------ + +This will cache the result of running "exif" on each blob +indefinitely. If you change the textconv config variable for a +diff driver, git will automatically invalidate the cache entries +and re-run the textconv filter. If you want to invalidate the +cache manually (e.g., because your version of "exif" was updated +and now produces better output), you can remove the cache +manually with `git update-ref -d refs/notes/textconv/jpg` (where +"jpg" is the name of the diff driver, as in the example above). Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 882749a04f828fccd795deec4d0bf10ba09ae549 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Wed, 14 Apr 2010 17:59:06 +0200 Subject: diff: add --word-diff option that generalizes --color-words This teaches the --color-words engine a more general interface that supports two new modes: * --word-diff=plain, inspired by the 'wdiff' utility (most similar to 'wdiff -n '): uses delimiters [-removed-] and {+added+} * --word-diff=porcelain, which generates an ad-hoc machine readable format: - each diff unit is prefixed by [-+ ] and terminated by newline as in unified diff - newlines in the input are output as a line consisting only of a tilde '~' Both of these formats still support color if it is enabled, using it to highlight the differences. --color-words becomes a synonym for --word-diff=color, which is the color-only format. Also adds some compatibility/convenience options. Thanks to Junio C Hamano and Miles Bader for good ideas. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d892e642ed..7554fcd07f 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -360,7 +360,7 @@ patterns are available: Customizing word diff ^^^^^^^^^^^^^^^^^^^^^ -You can customize the rules that `git diff --color-words` uses to +You can customize the rules that `git diff --word-diff` uses to split words in a line, by specifying an appropriate regular expression in the "diff.*.wordRegex" configuration variable. For example, in TeX a backslash followed by a sequence of letters forms a command, but -- cgit v1.2.3 From fd6cce9e89ab5ac1125a3b5f5611048ad22379e7 Mon Sep 17 00:00:00 2001 From: Eyvind Bernhardsen Date: Wed, 19 May 2010 22:43:10 +0200 Subject: Add per-repository eol normalization Change the semantics of the "crlf" attribute so that it enables end-of-line normalization when it is set, regardless of "core.autocrlf". Add a new setting for "crlf": "auto", which enables end-of-line conversion but does not override the automatic text file detection. Add a new attribute "eol" with possible values "crlf" and "lf". When set, this attribute enables normalization and forces git to use CRLF or LF line endings in the working directory, respectively. The line ending style to be used for normalized text files in the working directory is set using "core.autocrlf". When it is set to "true", CRLFs are used in the working directory; when set to "input" or "false", LFs are used. Signed-off-by: Eyvind Bernhardsen Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 138 ++++++++++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 25 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index b396a871b3..f621b23b84 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -95,50 +95,138 @@ repository upon 'git add' and 'git commit'. `crlf` ^^^^^^ -This attribute controls the line-ending convention. +This attribute enables and controls end-of-line normalization. When a +text file is normalized, its line endings are converted to LF in the +repository. To control what line ending style is used in the working +directory, use the `eol` attribute for a single file and the +`core.autocrlf` configuration variable for all text files. Set:: - Setting the `crlf` attribute on a path is meant to mark - the path as a "text" file. 'core.autocrlf' conversion - takes place without guessing the content type by - inspection. + Setting the `crlf` attribute on a path enables end-of-line + normalization and marks the path as a text file. End-of-line + conversion takes place without guessing the content type. Unset:: Unsetting the `crlf` attribute on a path tells git not to attempt any end-of-line conversion upon checkin or checkout. +Set to string value "auto":: + + When `crlf` is set to "auto", the path is marked for automatic + end-of-line normalization. If git decides that the content is + text, its line endings are normalized to LF on checkin. + Unspecified:: - Unspecified `crlf` attribute tells git to apply the - `core.autocrlf` conversion when the file content looks - like text. + If the `crlf` attribute is unspecified, git uses the `eol` + attribute and the `core.autocrlf` configuration variable to + determine if the file should be converted. -Set to string value "input":: +Any other value causes git to act as if `crlf` has been left +unspecified. - This is similar to setting the attribute to `true`, but - also forces git to act as if `core.autocrlf` is set to - `input` for the path. +`eol` +^^^^^ -Any other value set to `crlf` attribute is ignored and git acts -as if the attribute is left unspecified. +This attribute sets a specific line-ending style to be used in the +working directory. It enables end-of-line normalization without any +content checks, similar to setting the `crlf` attribute. +Set to string value "crlf":: -The `core.autocrlf` conversion -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + This setting forces git to normalize line endings on checkin + and convert them to CRLF when the file is checked out, + regardless of `crlf` and `core.autocrlf`. + +Set to string value "lf":: + + This setting forces git to normalize line endings to LF on + checkin and prevents conversion to CRLF when the file is + checked out, regardless of `crlf` and `core.autocrlf`. + `crlf=input` is a backwards compatibility alias for `eol=lf`. + +End-of-line conversion +^^^^^^^^^^^^^^^^^^^^^^ + +While git normally leaves file contents alone, it can be configured to +normalize line endings to LF in the repository and, optionally, to +convert them to CRLF when files are checked out. + +Here is an example that will make git normalize .txt, .vcproj and .sh +files, ensure that .vcproj files have CRLF and .sh files have LF in +the working directory, and prevent .jpg files from being normalized +regardless of their content. + +------------------------ +*.txt crlf +*.vcproj eol=crlf +*.sh eol=lf +*.jpg -crlf +------------------------ + +Other source code management systems normalize all text files in their +repositories, and there are two ways to enable similar automatic +normalization in git. + +If you simply want to have CRLF line endings in your working directory +regardless of the repository you are working with, you can set the +config variable "core.autocrlf" without changing any attributes. + +------------------------ +[core] + autocrlf = true +------------------------ + +This does not force normalization of all text files, but does ensure +that text files that you introduce to the repository have their line +endings normalized to LF when they are added, and that files that are +already normalized in the repository stay normalized. You can also +set `autocrlf` to "input" to have automatic normalization of new text +files without conversion to CRLF in the working directory. + +If you want to interoperate with a source code management system that +enforces end-of-line normalization, or you simply want all text files +in your repository to be normalized, you should instead set the `crlf` +attribute to "auto" for _all_ files. + +------------------------ +* crlf=auto +------------------------ + +This ensures that all files that git considers to be text will have +normalized (LF) line endings in the repository. -If the configuration variable `core.autocrlf` is false, no -conversion is done. +NOTE: When `crlf=auto` normalization is enabled in an existing +repository, any text files containing CRLFs should be normalized. If +they are not they will be normalized the next time someone tries to +change them, causing unfortunate misattribution. From a clean working +directory: -When `core.autocrlf` is true, it means that the platform wants -CRLF line endings for files in the working tree, and you want to -convert them back to the normal LF line endings when checking -in to the repository. +------------------------------------------------- +$ echo "* crlf=auto" >>.gitattributes +$ rm .git/index # Remove the index to force git to +$ git reset # re-scan the working directory +$ git status # Show files that will be normalized +$ git add -u +$ git add .gitattributes +$ git commit -m "Introduce end-of-line normalization" +------------------------------------------------- -When `core.autocrlf` is set to "input", line endings are -converted to LF upon checkin, but there is no conversion done -upon checkout. +If any files that should not be normalized show up in 'git status', +unset their `crlf` attribute before running 'git add -u'. + +------------------------ +manual.pdf -crlf +------------------------ + +Conversely, text files that git does not detect can have normalization +enabled manually. + +------------------------ +weirdchars.txt crlf +------------------------ If `core.safecrlf` is set to "true" or "warn", git verifies if the conversion is reversible for the current setting of -- cgit v1.2.3 From 5ec3e67052289217c84e53d2cda90d939ac5725b Mon Sep 17 00:00:00 2001 From: Eyvind Bernhardsen Date: Wed, 19 May 2010 22:43:11 +0200 Subject: Rename the "crlf" attribute "text" As discussed on the list, "crlf" is not an optimal name. Linus suggested "text", which is much better. Signed-off-by: Eyvind Bernhardsen Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 59 ++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 24 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index f621b23b84..1120b90a58 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -92,7 +92,7 @@ such as 'git checkout' and 'git merge' run. They also affect how git stores the contents you prepare in the working tree in the repository upon 'git add' and 'git commit'. -`crlf` +`text` ^^^^^^ This attribute enables and controls end-of-line normalization. When a @@ -103,28 +103,28 @@ directory, use the `eol` attribute for a single file and the Set:: - Setting the `crlf` attribute on a path enables end-of-line + Setting the `text` attribute on a path enables end-of-line normalization and marks the path as a text file. End-of-line conversion takes place without guessing the content type. Unset:: - Unsetting the `crlf` attribute on a path tells git not to + Unsetting the `text` attribute on a path tells git not to attempt any end-of-line conversion upon checkin or checkout. Set to string value "auto":: - When `crlf` is set to "auto", the path is marked for automatic + When `text` is set to "auto", the path is marked for automatic end-of-line normalization. If git decides that the content is text, its line endings are normalized to LF on checkin. Unspecified:: - If the `crlf` attribute is unspecified, git uses the `eol` + If the `text` attribute is unspecified, git uses the `eol` attribute and the `core.autocrlf` configuration variable to determine if the file should be converted. -Any other value causes git to act as if `crlf` has been left +Any other value causes git to act as if `text` has been left unspecified. `eol` @@ -132,20 +132,31 @@ unspecified. This attribute sets a specific line-ending style to be used in the working directory. It enables end-of-line normalization without any -content checks, similar to setting the `crlf` attribute. +content checks, similar to setting the `text` attribute. Set to string value "crlf":: This setting forces git to normalize line endings on checkin and convert them to CRLF when the file is checked out, - regardless of `crlf` and `core.autocrlf`. + regardless of `text` and `core.autocrlf`. Set to string value "lf":: This setting forces git to normalize line endings to LF on checkin and prevents conversion to CRLF when the file is - checked out, regardless of `crlf` and `core.autocrlf`. - `crlf=input` is a backwards compatibility alias for `eol=lf`. + checked out, regardless of `text` and `core.autocrlf`. + +Backwards compatibility with `crlf` attribute +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For backwards compatibility, the `crlf` attribute is interpreted as +follows: + +------------------------ +crlf text +-crlf -text +crlf=input eol=lf +------------------------ End-of-line conversion ^^^^^^^^^^^^^^^^^^^^^^ @@ -160,10 +171,10 @@ the working directory, and prevent .jpg files from being normalized regardless of their content. ------------------------ -*.txt crlf +*.txt text *.vcproj eol=crlf *.sh eol=lf -*.jpg -crlf +*.jpg -text ------------------------ Other source code management systems normalize all text files in their @@ -188,24 +199,24 @@ files without conversion to CRLF in the working directory. If you want to interoperate with a source code management system that enforces end-of-line normalization, or you simply want all text files -in your repository to be normalized, you should instead set the `crlf` +in your repository to be normalized, you should instead set the `text` attribute to "auto" for _all_ files. ------------------------ -* crlf=auto +* text=auto ------------------------ This ensures that all files that git considers to be text will have normalized (LF) line endings in the repository. -NOTE: When `crlf=auto` normalization is enabled in an existing +NOTE: When `text=auto` normalization is enabled in an existing repository, any text files containing CRLFs should be normalized. If they are not they will be normalized the next time someone tries to change them, causing unfortunate misattribution. From a clean working directory: ------------------------------------------------- -$ echo "* crlf=auto" >>.gitattributes +$ echo "* text=auto" >>.gitattributes $ rm .git/index # Remove the index to force git to $ git reset # re-scan the working directory $ git status # Show files that will be normalized @@ -215,17 +226,17 @@ $ git commit -m "Introduce end-of-line normalization" ------------------------------------------------- If any files that should not be normalized show up in 'git status', -unset their `crlf` attribute before running 'git add -u'. +unset their `text` attribute before running 'git add -u'. ------------------------ -manual.pdf -crlf +manual.pdf -text ------------------------ Conversely, text files that git does not detect can have normalization enabled manually. ------------------------ -weirdchars.txt crlf +weirdchars.txt text ------------------------ If `core.safecrlf` is set to "true" or "warn", git verifies if @@ -311,11 +322,11 @@ Interaction between checkin/checkout attributes In the check-in codepath, the worktree file is first converted with `filter` driver (if specified and corresponding driver defined), then the result is processed with `ident` (if -specified), and then finally with `crlf` (again, if specified +specified), and then finally with `text` (again, if specified and applicable). In the check-out codepath, the blob content is first converted -with `crlf`, and then `ident` and fed to `filter`. +with `text`, and then `ident` and fed to `filter`. Generating diff text @@ -718,7 +729,7 @@ You do not want any end-of-line conversions applied to, nor textual diffs produced for, any binary file you track. You would need to specify e.g. ------------ -*.jpg -crlf -diff +*.jpg -text -diff ------------ but that may become cumbersome, when you have many attributes. Using @@ -731,7 +742,7 @@ the same time. The system knows a built-in attribute macro, `binary`: which is equivalent to the above. Note that the attribute macros can only be "Set" (see the above example that sets "binary" macro as if it were an -ordinary attribute --- setting it in turn unsets "crlf" and "diff"). +ordinary attribute --- setting it in turn unsets "text" and "diff"). DEFINING ATTRIBUTE MACROS @@ -742,7 +753,7 @@ at the toplevel (i.e. not in any subdirectory). The built-in attribute macro "binary" is equivalent to: ------------ -[attr]binary -diff -crlf +[attr]binary -diff -text ------------ -- cgit v1.2.3 From 942e7747678ecf5f118ea5b2d0c763166de21f3a Mon Sep 17 00:00:00 2001 From: Eyvind Bernhardsen Date: Fri, 4 Jun 2010 21:29:08 +0200 Subject: Add "core.eol" config variable Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else. Note that "core.autocrlf" overrides core.eol. This means that [core] autocrlf = true puts CRLFs in the working directory even if core.eol is set to "lf". Signed-off-by: Eyvind Bernhardsen Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 1120b90a58..c2efe4c079 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -99,7 +99,7 @@ This attribute enables and controls end-of-line normalization. When a text file is normalized, its line endings are converted to LF in the repository. To control what line ending style is used in the working directory, use the `eol` attribute for a single file and the -`core.autocrlf` configuration variable for all text files. +`core.eol` configuration variable for all text files. Set:: @@ -120,9 +120,9 @@ Set to string value "auto":: Unspecified:: - If the `text` attribute is unspecified, git uses the `eol` - attribute and the `core.autocrlf` configuration variable to - determine if the file should be converted. + If the `text` attribute is unspecified, git uses the + `core.autocrlf` configuration variable to determine if the + file should be converted. Any other value causes git to act as if `text` has been left unspecified. @@ -132,19 +132,19 @@ unspecified. This attribute sets a specific line-ending style to be used in the working directory. It enables end-of-line normalization without any -content checks, similar to setting the `text` attribute. +content checks, effectively setting the `text` attribute. Set to string value "crlf":: - This setting forces git to normalize line endings on checkin - and convert them to CRLF when the file is checked out, - regardless of `text` and `core.autocrlf`. + This setting forces git to normalize line endings for this + file on checkin and convert them to CRLF when the file is + checked out. Set to string value "lf":: This setting forces git to normalize line endings to LF on checkin and prevents conversion to CRLF when the file is - checked out, regardless of `text` and `core.autocrlf`. + checked out. Backwards compatibility with `crlf` attribute ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,9 +193,7 @@ config variable "core.autocrlf" without changing any attributes. This does not force normalization of all text files, but does ensure that text files that you introduce to the repository have their line endings normalized to LF when they are added, and that files that are -already normalized in the repository stay normalized. You can also -set `autocrlf` to "input" to have automatic normalization of new text -files without conversion to CRLF in the working directory. +already normalized in the repository stay normalized. If you want to interoperate with a source code management system that enforces end-of-line normalization, or you simply want all text files @@ -207,7 +205,11 @@ attribute to "auto" for _all_ files. ------------------------ This ensures that all files that git considers to be text will have -normalized (LF) line endings in the repository. +normalized (LF) line endings in the repository. The `core.eol` +configuration variable controls which line endings git will use for +normalized files in your working directory; the default is to use the +native line ending for your platform, or CRLF if `core.autocrlf` is +set. NOTE: When `text=auto` normalization is enabled in an existing repository, any text files containing CRLFs should be normalized. If -- cgit v1.2.3 From f217f0e86dc7bacc5dc127982eaadca758b558ce Mon Sep 17 00:00:00 2001 From: Eyvind Bernhardsen Date: Fri, 2 Jul 2010 21:20:47 +0200 Subject: Avoid conflicts when merging branches with mixed normalization Currently, merging across changes in line ending normalization is painful since files containing CRLF will conflict with normalized files, even if the only difference between the two versions is the line endings. Additionally, any "real" merge conflicts that exist are obscured because every line in the file has a conflict. Assume you start out with a repo that has a lot of text files with CRLF checked in (A): o---C / \ A---B---D B: Add "* text=auto" to .gitattributes and normalize all files to LF-only C: Modify some of the text files D: Try to merge C You will get a ridiculous number of LF/CRLF conflicts when trying to merge C into D, since the repository contents for C are "wrong" wrt the new .gitattributes file. Fix ll-merge so that the "base", "theirs" and "ours" stages are passed through convert_to_worktree() and convert_to_git() before a three-way merge. This ensures that all three stages are normalized in the same way, removing from consideration differences that are only due to normalization. This feature is optional for now since it changes a low-level mechanism and is not necessary for the majority of users. The "merge.renormalize" config variable enables it. Signed-off-by: Eyvind Bernhardsen Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 564586b943..da553ff006 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -317,6 +317,17 @@ command is "cat"). smudge = cat ------------------------ +For best results, `clean` should not alter its output further if it is +run twice ("clean->clean" should be equivalent to "clean"), and +multiple `smudge` commands should not alter `clean`'s output +("smudge->smudge->clean" should be equivalent to "clean"). See the +section on merging below. + +The "indent" filter is well-behaved in this regard: it will not modify +input that is already correctly indented. In this case, the lack of a +smudge filter means that the clean filter _must_ accept its own output +without modifying it. + Interaction between checkin/checkout attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -331,6 +342,29 @@ In the check-out codepath, the blob content is first converted with `text`, and then `ident` and fed to `filter`. +Merging branches with differing checkin/checkout attributes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you have added attributes to a file that cause the canonical +repository format for that file to change, such as adding a +clean/smudge filter or text/eol/ident attributes, merging anything +where the attribute is not in place would normally cause merge +conflicts. + +To prevent these unnecessary merge conflicts, git can be told to run a +virtual check-out and check-in of all three stages of a file when +resolving a three-way merge by setting the `merge.renormalize` +configuration variable. This prevents changes caused by check-in +conversion from causing spurious merge conflicts when a converted file +is merged with an unconverted file. + +As long as a "smudge->clean" results in the same output as a "clean" +even on files that are already smudged, this strategy will +automatically resolve all filter-related conflicts. Filters that do +not act in this way may cause additional merge conflicts that must be +resolved manually. + + Generating diff text ~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From b221207db9950cb0993a30f38540ff235a0af64e Mon Sep 17 00:00:00 2001 From: Petr Onderka Date: Mon, 16 Aug 2010 17:01:02 +0000 Subject: Userdiff patterns for C# Add userdiff patterns for C#. This code is an improved version of code by Adam Petaccia from 21 June 2009 mail to the list. Signed-off-by: Petr Onderka Acked-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 564586b943..2e2370ccdb 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -441,6 +441,8 @@ patterns are available: - `cpp` suitable for source code in the C and C++ languages. +- `csharp` suitable for source code in the C# language. + - `html` suitable for HTML/XHTML documents. - `java` suitable for source code in the Java language. -- cgit v1.2.3 From 6df42ab98480dcac473ca7d701cfca4a0051d0c1 Mon Sep 17 00:00:00 2001 From: Petr Onderka Date: Wed, 1 Sep 2010 00:42:43 +0200 Subject: Add global and system-wide gitattributes Allow gitattributes to be set globally and system wide. This way, settings for particular file types can be set in one place and apply for all user's repositories. The location of system-wide attributes file is $(prefix)/etc/gitattributes. The location of the global file can be configured by setting core.attributesfile. Some parts of the code were copied from the implementation of the same functionality in config.c. Signed-off-by: Petr Onderka Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 564586b943..c6bdeae66d 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -62,14 +62,21 @@ 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). +is from the path in question, the lower its precedence). Finally +global and system-wide files are considered (they have the lowest +precedence). If you wish to affect only a single repository (i.e., to assign -attributes to files that are particular to one user's workflow), then +attributes to files that are particular to +one user's workflow for that repository), then attributes should be placed in the `$GIT_DIR/info/attributes` file. Attributes which should be version-controlled and distributed to other repositories (i.e., attributes of interest to all users) should go into -`.gitattributes` files. +`.gitattributes` files. Attributes that should affect all repositories +for a single user should be placed in a file specified by the +`core.attributesfile` configuration option (see linkgit:git-config[1]). +Attributes for all users on a system should be placed in the +`$(prefix)/etc/gitattributes` file. Sometimes you would need to override an setting of an attribute for a path to `unspecified` state. This can be done by listing -- cgit v1.2.3 From 909a5494f869371565ed9326e984adeabf42611d Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Fri, 10 Sep 2010 11:18:14 -0500 Subject: userdiff.c: add builtin fortran regex patterns This adds fortran xfuncname and wordRegex patterns to the list of builtin patterns. The intention is for the patterns to be appropriate for all versions of fortran including 77, 90, 95. The patterns can be enabled by adding the diff=fortran attribute to the .gitattributes file for the desired file glob. This also adds a new macro named IPATTERN which is just like the PATTERNS macro except it sets the REG_ICASE flag so that case will be ignored. The test code in t4018 and the docs were updated as appropriate. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index e5a27d875e..fbf507a7ee 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -477,6 +477,8 @@ patterns are available: - `csharp` suitable for source code in the C# language. +- `fortran` suitable for source code in the Fortran language. + - `html` suitable for HTML/XHTML documents. - `java` suitable for source code in the Java language. -- cgit v1.2.3 From f4b05a4947f5f1cf3e01fb61ec5919cc28fe11f7 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 30 Nov 2010 09:29:11 +0100 Subject: Make the tab width used for whitespace checks configurable A new whitespace "rule" is added that sets the tab width to use for whitespace checks and fix-ups and replaces the hard-coded constant 8. Since the setting is part of the rules, it can be set per file using .gitattributes. The new configuration is backwards compatible because older git versions simply ignore unknown whitespace rules. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index c80ca5da43..5a7f936429 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -723,6 +723,8 @@ control per path. Set:: Notice all types of potential whitespace errors known to git. + The tab width is taken from the value of the `core.whitespace` + configuration variable. Unset:: @@ -730,13 +732,13 @@ Unset:: Unspecified:: - Use the value of `core.whitespace` configuration variable to + Use the value of the `core.whitespace` configuration variable to decide what to notice as error. String:: Specify a comma separate list of common whitespace problems to - notice in the same format as `core.whitespace` configuration + notice in the same format as the `core.whitespace` configuration variable. -- cgit v1.2.3 From a2b665de4b694b04959f6371f9887f7ad5cae404 Mon Sep 17 00:00:00 2001 From: Pete Wyckoff Date: Wed, 22 Dec 2010 06:40:13 -0800 Subject: convert filter: supply path to external driver Filtering to support keyword expansion may need the name of the file being filtered. In particular, to support p4 keywords like $File: //depot/product/dir/script.sh $ the smudge filter needs to know the name of the file it is smudging. Allow "%f" in the custom filter command line specified in the configuration. This will be substituted by the filename inside a single-quote pair to be passed to the shell. Signed-off-by: Pete Wyckoff Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 5a7f936429..22b85825ab 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -335,6 +335,16 @@ input that is already correctly indented. In this case, the lack of a smudge filter means that the clean filter _must_ accept its own output without modifying it. +Sequence "%f" on the filter command line is replaced with the name of +the file the filter is working on. A filter might use this in keyword +substitution. For example: + +------------------------ +[filter "p4"] + clean = git-p4-filter --clean %f + smudge = git-p4-filter --smudge %f +------------------------ + Interaction between checkin/checkout attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From 71a5d4bc0e4025b3fbdeed76052b39fcef284e8c Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 26 Dec 2010 03:07:31 -0600 Subject: diff: funcname and word patterns for perl The default function name discovery already works quite well for Perl code... with the exception of here-documents (or rather their ending). sub foo { print < Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 5a7f936429..e59b878293 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -494,6 +494,8 @@ patterns are available: - `pascal` suitable for source code in the Pascal/Delphi language. +- `perl` suitable for source code in the Perl language. + - `php` suitable for source code in the PHP language. - `python` suitable for source code in the Python language. -- cgit v1.2.3 From ab4356111afb28568bf1ad2e909b6ecf9f83a5e6 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 9 Jan 2011 15:10:04 -0500 Subject: docs: explain diff.*.binary option This was added long ago as part of the userdiff refactoring for textconv, as internally it made the code simpler and cleaner. However, there was never a concrete use case for actually using the config variable. Now that Matthieu Moy has provided such a use case, it's easy to explain it using his example. Signed-off-by: Jeff King Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d892e642ed..f3f880e270 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -415,6 +415,39 @@ should generate it separately and send it as a comment _in addition to_ the usual binary diff that you might send. +Marking files as binary +^^^^^^^^^^^^^^^^^^^^^^^ + +Git usually guesses correctly whether a blob contains text or binary +data by examining the beginning of the contents. However, sometimes you +may want to override its decision, either because a blob contains binary +data later in the file, or because the content, while technically +composed of text characters, is opaque to a human reader. For example, +many postscript files contain only ascii characters, but produce noisy +and meaningless diffs. + +The simplest way to mark a file as binary is to unset the diff +attribute in the `.gitattributes` file: + +------------------------ +*.ps -diff +------------------------ + +This will cause git to generate `Binary files differ` (or a binary +patch, if binary patches are enabled) instead of a regular diff. + +However, one may also want to specify other diff driver attributes. For +example, you might want to use `textconv` to convert postscript files to +an ascii representation for human viewing, but otherwise treat them as +binary files. You cannot specify both `-diff` and `diff=ps` attributes. +The solution is to use the `diff.*.binary` config option: + +------------------------ +[diff "ps"] + textconv = ps2ascii + binary = true +------------------------ + Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From b547ce0b184f152938f2ea709b9932fa0d6181f8 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 18 Mar 2011 15:14:27 +0200 Subject: docs: fix grammar in gitattributes.txt [jc: with a fixlet from Marc Branchaud] Signed-off-by: Alexei Sholik Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 7e7e12168e..15aebc6062 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -632,7 +632,7 @@ Performing a three-way merge `merge` ^^^^^^^ -The attribute `merge` affects how three versions of a file is +The attribute `merge` affects how three versions of a file are merged when a file-level merge is necessary during `git merge`, and other commands such as `git revert` and `git cherry-pick`. @@ -646,15 +646,15 @@ Unset:: Take the version from the current branch as the tentative merge result, and declare that the merge has - conflicts. This is suitable for binary files that does + conflicts. This is suitable for binary files that do not have a well-defined merge semantics. Unspecified:: By default, this uses the same built-in 3-way merge - driver as is the case the `merge` attribute is set. - However, `merge.default` configuration variable can name - different merge driver to be used for paths to which the + driver as is the case when the `merge` attribute is set. + However, the `merge.default` configuration variable can name + different merge driver to be used with paths for which the `merge` attribute is unspecified. String:: -- cgit v1.2.3 From 55601c6a4598f3b37e8269beff3275d6592053dd Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 24 May 2011 15:45:27 -0400 Subject: doc: discuss textconv versus external diff drivers We already talk about how to use each one and how they work, but it is a reasonable question to wonder why one might use one over the other. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 15aebc6062..412c55b549 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -593,6 +593,37 @@ and now produces better output), you can remove the cache manually with `git update-ref -d refs/notes/textconv/jpg` (where "jpg" is the name of the diff driver, as in the example above). +Choosing textconv versus external diff +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you want to show differences between binary or specially-formatted +blobs in your repository, you can choose to use either an external diff +command, or to use textconv to convert them to a diff-able text format. +Which method you choose depends on your exact situation. + +The advantage of using an external diff command is flexibility. You are +not bound to find line-oriented changes, nor is it necessary for the +output to resemble unified diff. You are free to locate and report +changes in the most appropriate way for your data format. + +A textconv, by comparison, is much more limiting. You provide a +transformation of the data into a line-oriented text format, and git +uses its regular diff tools to generate the output. There are several +advantages to choosing this method: + +1. Ease of use. It is often much simpler to write a binary to text + transformation than it is to perform your own diff. In many cases, + existing programs can be used as textconv filters (e.g., exif, + odt2txt). + +2. Git diff features. By performing only the transformation step + yourself, you can still utilize many of git's diff features, + including colorization, word-diff, and combined diffs for merges. + +3. Caching. Textconv caching can speed up repeated diffs, such as those + you might trigger by running `git log -p`. + + Marking files as binary ^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From 98e840663251fc99055265b9bd4710e398310eb7 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Wed, 3 Aug 2011 15:41:29 +0200 Subject: gitattributes: Clarify discussion of attribute macros In particular, make it clear that attribute macros are themselves recorded as attributes in addition to setting other attributes. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 412c55b549..ccb3f3f14e 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -879,16 +879,19 @@ produced for, any binary file you track. You would need to specify e.g. ------------ but that may become cumbersome, when you have many attributes. Using -attribute macros, you can specify groups of attributes set or unset at -the same time. The system knows a built-in attribute macro, `binary`: +attribute macros, you can define an attribute that, when set, also +sets or unsets a number of other attributes at the same time. The +system knows a built-in attribute macro, `binary`: ------------ *.jpg binary ------------ -which is equivalent to the above. Note that the attribute macros can only -be "Set" (see the above example that sets "binary" macro as if it were an -ordinary attribute --- setting it in turn unsets "text" and "diff"). +Setting the "binary" attribute also unsets the "text" and "diff" +attributes as above. Note that attribute macros can only be "Set", +though setting one might have the effect of setting or unsetting other +attributes or even returning other attributes to the "Unspecified" +state. DEFINING ATTRIBUTE MACROS -- cgit v1.2.3 From 0922570c76ae407e30477d27d72bb9d72c4b65f9 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Wed, 3 Aug 2011 15:41:30 +0200 Subject: gitattributes: Reword "attribute macro" to "macro attribute" The new wording makes it clearer that such a beast is an attribute in addition to being a macro (as opposed to being only a macro that is used for attributes). Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index ccb3f3f14e..2bbe76b5d8 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -79,7 +79,7 @@ Attributes for all users on a system should be placed in the `$(prefix)/etc/gitattributes` file. Sometimes you would need to override an setting of an attribute -for a path to `unspecified` state. This can be done by listing +for a path to `Unspecified` state. This can be done by listing the name of the attribute prefixed with an exclamation point `!`. @@ -868,7 +868,7 @@ If this attribute is not set or has an invalid value, the value of the (See linkgit:git-config[1]). -USING ATTRIBUTE MACROS +USING MACRO ATTRIBUTES ---------------------- You do not want any end-of-line conversions applied to, nor textual diffs @@ -879,27 +879,27 @@ produced for, any binary file you track. You would need to specify e.g. ------------ but that may become cumbersome, when you have many attributes. Using -attribute macros, you can define an attribute that, when set, also +macro attributes, you can define an attribute that, when set, also sets or unsets a number of other attributes at the same time. The -system knows a built-in attribute macro, `binary`: +system knows a built-in macro attribute, `binary`: ------------ *.jpg binary ------------ Setting the "binary" attribute also unsets the "text" and "diff" -attributes as above. Note that attribute macros can only be "Set", +attributes as above. Note that macro attributes can only be "Set", though setting one might have the effect of setting or unsetting other attributes or even returning other attributes to the "Unspecified" state. -DEFINING ATTRIBUTE MACROS +DEFINING MACRO ATTRIBUTES ------------------------- -Custom attribute macros can be defined only in the `.gitattributes` file -at the toplevel (i.e. not in any subdirectory). The built-in attribute -macro "binary" is equivalent to: +Custom macro attributes can be defined only in the `.gitattributes` +file at the toplevel (i.e. not in any subdirectory). The built-in +macro attribute "binary" is equivalent to: ------------ [attr]binary -diff -text -- cgit v1.2.3 From cde151815eb409d8dd457e7aaa3ded2e53796343 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 4 Aug 2011 06:36:11 +0200 Subject: doc: Add a link from gitattributes(5) to git-check-attr(1) Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 412c55b549..3d8643437e 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -952,6 +952,9 @@ frotz unspecified ---------------------------------------------------------------- +SEE ALSO +-------- +linkgit:git-check-attr[1]. GIT --- -- cgit v1.2.3