aboutsummaryrefslogtreecommitdiffstats
path: root/git/git-cdiff
diff options
context:
space:
mode:
Diffstat (limited to 'git/git-cdiff')
-rwxr-xr-xgit/git-cdiff20
1 files changed, 20 insertions, 0 deletions
diff --git a/git/git-cdiff b/git/git-cdiff
new file mode 100755
index 0000000..bd4ae31
--- /dev/null
+++ b/git/git-cdiff
@@ -0,0 +1,20 @@
+#!/bin/dash
+if test -z "${GIT_CDIFF_CONTEXT}"; then
+ git difftool -y -x "diff -c --color=always" "$@"
+elif echo "${GIT_CDIFF_CONTEXT}" | grep -q '^-'; then
+ git difftool -y -x "diff ${GIT_CDIFF_CONTEXT} --color=always" "$@"
+else
+ git difftool -y -x "diff -C${GIT_CDIFF_CONTEXT} --color=always" "$@"
+fi | {
+ if test "$TERM" = linux; then
+ sed '/^\(\x1b\[[0-9;]*m\)* /s/\x1b\[[0-9;]*m//g'
+ else
+ sed '/^\(\x1b\[[0-9;]*m\)* /s/^/\x1b\[2m/g'
+ fi
+} | {
+ if test -t 1; then
+ less -R
+ else
+ cat
+ fi
+}