gitattributes.star¶
Set attributes for path patterns in .gitattributes, such as line endings and Git LFS tracking.
| Function | What it does |
|---|---|
set |
Gives a pattern attributes, merging with any it already has. |
track_lfs |
Tracks a pattern with Git LFS, as git lfs track would. |
set¶
Gives a pattern attributes, merging with any it already has.
An attribute already on the pattern's line is replaced by the new one
with the same name, so eol=crlf becomes eol=lf and text becomes
-text; other attributes stay. A pattern with no line gets one at the
end. The file is created if needed.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
pattern |
The path pattern, such as *.sh or *. |
attributes |
The attributes, as a space-separated string or a list, such as "text eol=lf". |
Returns: True when the file changed.
Example
Used in: editor-defaults
track_lfs¶
Tracks a pattern with Git LFS, as git lfs track would.
This only edits .gitattributes; files already committed stay in Git until they are migrated.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
pattern |
The path pattern, such as *.psd. |
Returns: True when the file changed.
Example