File tree 2 files changed +59
-0
lines changed 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ # git diff drivers
2
+
3
+ ## Usage
4
+
5
+ To use any of these diff drivers, add them to your ` $PATH ` , add a git config
6
+ entry to your (global) git config and then set a matching git attribute for the
7
+ files you want to use the driver for. There's a config and attribute example
8
+ given for each driver.
9
+
10
+ Note that many git tools, like ` git log ` and ` git show ` will only utilize diff
11
+ drivers if you use the ` --ext-diff ` flag.
12
+
13
+ ## composer-lock-diff-driver
14
+
15
+ The composer-lock-diff-driver utilizes
16
+ [ composer-lock-diff] ( https://github.com/davidrjonas/composer-lock-diff ) to
17
+ display changes to ` composer.lock ` files in a more readable way.
18
+
19
+ ### git config
20
+
21
+ ``` bash
22
+ git config --global diff.composer-lock-diff.command composer-lock-diff-driver
23
+ ```
24
+
25
+ ### .gitattributes
26
+
27
+ ```
28
+ composer.lock diff=composer-lock-diff
29
+ ```
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ NEW_FILE=$1
4
+ OLD_FILE=$1
5
+ NEW_REV=" $( git rev-parse --short $6 ) "
6
+ INDEX_MODE=$7
7
+
8
+ if [ " $2 " = " /dev/null" ]; then
9
+ OLD_REV=0000000
10
+ OLD_FILE=$2
11
+ INDEX_MODE=
12
+ else
13
+ OLD_REV=" $( git rev-parse --short $3 ) "
14
+ fi
15
+
16
+ echo -e " \e[1mdiff --git $1 $1 "
17
+
18
+ if [ " $2 " = " /dev/null" ]; then
19
+ echo -e " \e[1mnew file mode $7 "
20
+ fi
21
+
22
+ echo -e " \e[1mindex $OLD_REV ..$NEW_REV $INDEX_MODE "
23
+ echo -e " \e[1m--- $OLD_FILE "
24
+ echo -e " \e[1m+++ $NEW_FILE "
25
+
26
+ if [ " $2 " = " /dev/null" ]; then
27
+ echo ' {"packages":[],"packages-dev":[]}' | exec composer-lock-diff --from php://fd/0 --to " $5 "
28
+ else
29
+ exec composer-lock-diff --from " $2 " --to " $5 "
30
+ fi
You can’t perform that action at this time.
0 commit comments