Skip to content

Commit 126f955

Browse files
Document usage as a git-driver in README
Co-Authored-By: Chris Simpkins <[email protected]>
1 parent 3d6c3f0 commit 126f955

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Display the first n lines of the diff output with the `--head` option
3434
- Display the last n lines of the diff output with the `--tail` option
3535
- Execute the diff with an external diff tool using the `--external` option
36+
- Use in Git as a diff-driver to be the default diff tool for fonts
3637

3738
Run `fdiff --help` to view all available options.
3839

@@ -101,6 +102,30 @@ $ fdiff [OPTIONS] [PRE-FONT FILE URL] [POST-FONT FILE FILE PATH]
101102

102103
**Tip**: Remote git repository hosting services (like Github) support access to files on different git branches by URL. Use these repository branch URL to compare fonts across git branches in your repository.
103104

105+
#### As Git's diff driver for fonts
106+
107+
Git can be configured to automatically use a specific tool to diff specific file types. These are the steps to use `fdiff` as the default diff output for font files.
108+
109+
1. Tell Git how to run the tool. As with most git configuration options this may be set for a repository (`--local`), for your user (`--global`), or system (`--system`). We recommend setting this at the user level. Assuming `fdiff` is available in your path, this setting should do the trick:
110+
111+
git config --global diff.fdiff.command 'fdiff -c --git'
112+
113+
This will write it to your `$HOME/.gitconfig` file looking like this:
114+
115+
```gitconfig
116+
[diff "fdiff"]
117+
command = fdiff -c --git
118+
```
119+
120+
Of course you may also edit it there.
121+
122+
2. Tell Git to use that specific tool for supported file types. This may also be done at multiple places. Each repository may have it's own `.gitattributes` file, a user may have one setting global defaults in `$XDG_HOME/git/attributes`, or there may be a system wide default file. Wherever you choose to place this, the lines are the same:
123+
124+
```gitattributes
125+
.otf diff=fdiff
126+
.ttf diff=fdiff
127+
```
128+
104129
### Options
105130

106131
#### Color diffs
@@ -227,5 +252,3 @@ Unless required by applicable law or agreed to in writing, software distributed
227252
#### CPython `difflib` library
228253

229254
This project distributes a modified version of third party source code from the [Python programming language standard library](https://github.com/python/cpython). The `difflib.py` v3.7.4 module is Copyright © 2001-2019 Python Software Foundation; All Rights Reserved. This source is modified and distributed in this project under the [PSF LICENSE AGREEMENT FOR PYTHON 3.7.4](https://github.com/source-foundry/fdiff/blob/master/lib/fdiff/thirdparty/PYTHON_LICENSE). The module is renamed to `fdifflib.py` to distinguish it from the upstream source, and modifications made here are documented in comments at the head of the module.
230-
231-

0 commit comments

Comments
 (0)