diff options
author | wsha.code+ga@b38779424f41c5701bbe5937340be43ff1474b2d <wshacodega@web> | 2015-10-09 18:45:13 +0000 |
---|---|---|
committer | admin <admin@branchable.com> | 2015-10-09 18:45:13 +0000 |
commit | a3a05342753c792a36e40154587e74dca1b32efa (patch) | |
tree | ce1d2af29ca10944d540cbd963bee51c646d690e | |
parent | 9b2c5282a627c9e73b4784c41fc5c225d8a0bfdb (diff) |
-rw-r--r-- | doc/forum/git-like_git-annex_diff.mdwn | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/forum/git-like_git-annex_diff.mdwn b/doc/forum/git-like_git-annex_diff.mdwn new file mode 100644 index 000000000..59205d624 --- /dev/null +++ b/doc/forum/git-like_git-annex_diff.mdwn @@ -0,0 +1,11 @@ +It took me some trial and error to get `git-annex diffdriver` to work close to the way I wanted (basically, the same way `git diff` works in a normal git repository with `color.ui` set to `always` with `git config`, so I thought I'd put my notes here for others: + +* Install `colordiff` (I couldn't figure out what `git`'s actual default diff program was or if it was possible to use it outside of `git diff`, so I went with this. +* Create a wrapper script to pass to `git-annex diffdriver`. `LANG=C` was to avoid a warning produced by `perl` when it runs `colordiff`. `exit 0` is needed because `colordiff`/`diff` has a non-zero exit status when the files it is passed are not identical and `git` expects the external diff program to exit with status 0: + + #!/usr/bin/env bash + LANG=C colordiff -c "$1" "$2" + exit 0 + +* Put the wrapper script somewhere on `PATH`, make it executable, and name it something like `git-annex-diff-wrapper`. +* Configure the repo to use the wrapper: `git config diff.external "git-annex diffdriver -- git-annex-diff-wrapper --"` |