File tree Expand file tree Collapse file tree 7 files changed +24
-60
lines changed Expand file tree Collapse file tree 7 files changed +24
-60
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ uninstall:
1111setup :
1212 @rm -rf vendor
1313 @mkdir -p vendor
14- git clone --depth 1 git://github.com/sstephenson/bats.git vendor/bats
14+ git clone --depth 1 git://github.com/sstephenson/bats.git vendor/bats
15+ git clone --depth 1 git://github.com/ztombol/bats-assert.git vendor/bats-assert
16+ git clone --depth 1 git://github.com/ztombol/bats-support.git vendor/bats-support
1517
1618test :
1719 vendor/bats/bin/bats test
Original file line number Diff line number Diff line change 44
55Running ` git diff ` on files encrypted with ansible vault results in some pretty unhelpful output.
66
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.
7+ ` git-diff-ansible-vault ` is custom git utility that detects files encrypted with ansible vault within the diff, and safely decrypts them to reveal the true changes.
88
9- ![ git-diff-ansible-vault animated demo] ( https://github.com/tommarshall/git-diff-ansible-vault/blob/master/img/ demo.gif )
9+ ![ git-diff-ansible-vault animated demo] ( https://github.com/tommarshall/git-diff-ansible-vault/blob/master/demo.gif )
1010
1111## Installation
1212
Original file line number Diff line number Diff line change 77# https://github.com/tommarshall/git-diff-ansible-vault
88#
99
10- VERSION=0.3 .0
10+ VERSION=0.4 .0
1111REVISION=
1212PATH_SCOPE=
1313GIT_DIFF_ARGS=
@@ -250,7 +250,7 @@ colordiff_wrap() {
250250
251251set_default_color () {
252252 if [ -z $COLOR ]; then
253- COLOR=$( git config --get color.ui || echo ' auto' )
253+ COLOR=$( git config --get color.diff || git config --get color. ui || echo ' auto' )
254254 if is_color && ! has_colordiff; then
255255 warn " Default --color '$COLOR ' requires colordiff"
256256 COLOR=' never'
Original file line number Diff line number Diff line change 11#! /usr/bin/env bats
22
3+ load ../vendor/bats-support/load
4+ load ../vendor/bats-assert/load
35load test_helper
46
5- # cd to fixture and move the git dir out of the shadows
6- setup () {
7- cd " $BATS_TEST_DIRNAME /fixture/repo.git"
8- mv " git" " .git"
9- }
10-
11- # hide the git dir in the fixture, so we don't have to use submodules
12- teardown () {
13- cd " $BATS_TEST_DIRNAME /fixture/repo.git"
14- mv " .git" " git"
15- }
16-
177@test " without --revision or --path shows all work-in-progress changes" {
188 run git diff-ansible-vault
199 assert_success
Original file line number Diff line number Diff line change 33PATH=" ${BATS_TEST_DIRNAME} /../bin:$PATH "
44export PATH
55
6- flunk () {
7- echo " $@ "
8- return 1
9- }
10-
11- assert_success () {
12- if [ " $status " -ne 0 ]; then
13- flunk " command failed with exit status $status "
14- elif [ " $# " -gt 0 ]; then
15- assert_output " $1 "
16- fi
17- }
6+ # Remember where the hook is
7+ BASE_DIR=$( dirname $BATS_TEST_DIRNAME )
8+ # Set up a directory for our git repo
9+ TMP_DIRECTORY=$( mktemp -d)
1810
19- assert_failure () {
20- if [ " $status " -eq 0 ]; then
21- flunk " expected failed exit status"
22- elif [ " $# " -gt 0 ]; then
23- assert_output " $1 "
24- fi
11+ setup () {
12+ # copy the test fixture and move the git dir out of the shadows
13+ cp -r " $BATS_TEST_DIRNAME /fixture/repo.git" " $TMP_DIRECTORY "
14+ mv " $TMP_DIRECTORY /repo.git/git" " $TMP_DIRECTORY /repo.git/.git"
15+ cd " $TMP_DIRECTORY /repo.git"
2516}
2617
27- assert_equal () {
28- if [ " $1 " != " $2 " ]; then
29- { echo " expected: $1 "
30- echo " actual: $2 "
31- } | flunk
32- fi
33- }
34-
35- assert_output () {
36- local expected
37- if [ $# -eq 0 ]; then
38- expected=" $( cat -) "
18+ teardown () {
19+ if [ $BATS_TEST_COMPLETED ]; then
20+ echo " Deleting $TMP_DIRECTORY "
21+ rm -rf $TMP_DIRECTORY
3922 else
40- expected= " $1 "
23+ echo " ** Did not delete $TMP_DIRECTORY , as test failed ** "
4124 fi
42- assert_equal " $expected " " $output "
43- }
4425
45- assert_line () {
46- if [ " $1 " -ge 0 ] 2> /dev/null; then
47- assert_equal " $2 " " ${lines[$1]} "
48- else
49- local line
50- for line in " ${lines[@]} " ; do
51- if [ " $line " = " $1 " ]; then return 0; fi
52- done
53- flunk " expected line \` $1 '"
54- fi
26+ cd $BATS_TEST_DIRNAME
5527}
You can’t perform that action at this time.
0 commit comments