|
| 1 | +# Git Diff Ansible Vault |
| 2 | + |
| 3 | +[](https://travis-ci.org/tommarshall/git-diff-ansible-vault) |
| 4 | + |
| 5 | +Running `git diff` on files encrypted with ansible vault results in some pretty unhelpful output. |
| 6 | + |
| 7 | +`git-diff-ansible-vault` is custom git command that detects files encrypted with ansible vault within the diff, and safely decrypts them to reveal the true changes. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +```sh |
| 14 | +$ git clone https://github.com/tommarshall/git-diff-ansible-vault.git |
| 15 | +$ cd git-diff-ansible-vault |
| 16 | +$ [sudo] make install |
| 17 | +``` |
| 18 | + |
| 19 | +By default, `git-diff-ansible-vault` is installed under `/usr/local`. To install it at an alternate location, specify a `PREFIX` when calling make. See the [Makefile](./Makefile) for details. |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +```sh |
| 24 | +# diff uncommitted changes |
| 25 | +$ git diff-ansible-vault |
| 26 | + |
| 27 | +# specify a revision and restrict the diff to a path |
| 28 | +$ git diff-ansible-vault -r master..some-branch -p path/to/dir |
| 29 | + |
| 30 | +# specify a vault password file to avoid prompt (will look for .vault-pass by default) |
| 31 | +$ git diff-ansible-vault --vault-password-file .vaultpass |
| 32 | + |
| 33 | +# show full usage information and options |
| 34 | +$ git diff-ansible-vault -h |
| 35 | +``` |
| 36 | + |
| 37 | +### Options |
| 38 | + |
| 39 | +``` |
| 40 | + -r, --revision <revision> show diff for git revision, e.g. master..some-branch |
| 41 | + -p, --path <path> restrict diff to path, e.g. support/config.yml |
| 42 | + --vault-password-file <path> vault password file path, defaults to .vault-pass |
| 43 | + --vault-only restrict diff to vault files only |
| 44 | + --color, --colour turn on coloured output |
| 45 | + --no-color, --no-colour turn off coloured diff |
| 46 | + --verbose display verbose output |
| 47 | + -v, --version output program version |
| 48 | + -h, --help output help information |
| 49 | +``` |
| 50 | + |
| 51 | +## Dependencies |
| 52 | + |
| 53 | +Ansible 1.8 or newer, as the scritpt relies on `ansible-vault view`. |
| 54 | + |
| 55 | +You'll need [colordiff](http://www.colordiff.org/) if you want colored output. |
| 56 | + |
| 57 | +`brew install colordiff` on OS X, `apt-get install colordiff` on Debian/Ubuntu. |
| 58 | + |
| 59 | +## Credits |
| 60 | + |
| 61 | +* [JonathonMA's `ansible-vault-git-diff` script](https://gist.github.com/JonathonMA/83cf96008c078d5f907a) |
0 commit comments