Browse code

hack/validate/vendor: print diff for modified files

In case some files were modified (rather than merely added
or removed), we're curious to see the diff for those.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2019/10/29 11:18:23
Showing 1 changed files
... ...
@@ -13,6 +13,7 @@ validate_vendor_diff(){
13 13
 		vndr
14 14
 		# check if any files have changed
15 15
 		diffs="$(git status --porcelain -- vendor 2>/dev/null)"
16
+		mfiles="$(echo "$diffs" | awk '/^ M / {print $2}')"
16 17
 		if [ "$diffs" ]; then
17 18
 			{
18 19
 				echo 'The result of vndr differs'
... ...
@@ -21,6 +22,9 @@ validate_vendor_diff(){
21 21
 				echo
22 22
 				echo 'Please vendor your package with github.com/LK4D4/vndr.'
23 23
 				echo
24
+				if [ -n "$mfiles" ] ; then
25
+					git diff -- "$mfiles"
26
+				fi
24 27
 			} >&2
25 28
 			false
26 29
 		else