Skip to content

Commit f5e34bb

Browse files
committed
[#31] Force git diff to use the default prefixes.
This supports the `diff.noPrefix` git configuration.
1 parent ac35e70 commit f5e34bb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apply-format

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,11 @@ else # Diff-only.
302302
readonly patch_dest=/dev/stdout
303303
fi
304304

305-
declare git_args=(git diff -U0 --no-color)
305+
# To support git when it is configured to use a non-default prefix, use
306+
# --src-prefix and --dst-prefix to set the default prefixes explicitly. We
307+
# don't use the newer --default-prefix option because we want to support git
308+
# versions older than 2.41.
309+
declare git_args=(git diff -U0 --no-color --src-prefix=a/ --dst-prefix=b/)
306310
[ "$staged" = true ] && git_args+=("--staged")
307311

308312
# $format_diff may contain a command ("python") and the script to excute, so we

0 commit comments

Comments
 (0)