Skip to content

Commit d79f5d1

Browse files
Nanako Shiraishigitster
authored andcommitted
Illustrate "filter" attribute with an example
The example was taken from aa4ed40 (Add 'filter' attribute and external filter driver definition). Signed-off-by: Nanako Shiraishi <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9861b64 commit d79f5d1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,25 @@ intent is that if someone unsets the filter driver definition,
197197
or does not have the appropriate filter program, the project
198198
should still be usable.
199199

200+
For example, in .gitattributes, you would assign the `filter`
201+
attribute for paths.
202+
203+
------------------------
204+
*.c filter=indent
205+
------------------------
206+
207+
Then you would define a "filter.indent.clean" and "filter.indent.smudge"
208+
configuration in your .git/config to specify a pair of commands to
209+
modify the contents of C programs when the source files are checked
210+
in ("clean" is run) and checked out (no change is made because the
211+
command is "cat").
212+
213+
------------------------
214+
[filter "indent"]
215+
clean = indent
216+
smudge = cat
217+
------------------------
218+
200219

201220
Interaction between checkin/checkout attributes
202221
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)