Skip to content

Commit

Permalink
Document usage as a git-driver in README
Browse files Browse the repository at this point in the history
Co-Authored-By: Chris Simpkins <[email protected]>
  • Loading branch information
alerque and chrissimpkins committed Apr 21, 2020
1 parent 3d6c3f0 commit 126f955
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Display the first n lines of the diff output with the `--head` option
- Display the last n lines of the diff output with the `--tail` option
- Execute the diff with an external diff tool using the `--external` option
- Use in Git as a diff-driver to be the default diff tool for fonts

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

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

**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.

#### As Git's diff driver for fonts

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.

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:

git config --global diff.fdiff.command 'fdiff -c --git'

This will write it to your `$HOME/.gitconfig` file looking like this:

```gitconfig
[diff "fdiff"]
command = fdiff -c --git
```

Of course you may also edit it there.

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:

```gitattributes
.otf diff=fdiff
.ttf diff=fdiff
```

### Options

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

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.


0 comments on commit 126f955

Please sign in to comment.