From 0effd071f3c14c0290820b5fb581ba5978da7118 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 18 Sep 2023 11:35:36 +0100 Subject: [PATCH] feat(git): set difft as diff application if available --- zsh/git.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zsh/git.zsh b/zsh/git.zsh index 8a713a9..781b98e 100644 --- a/zsh/git.zsh +++ b/zsh/git.zsh @@ -5,9 +5,19 @@ # Stolen from: https://stackoverflow.com/a/42544963 git-largest-objects() { git rev-list --objects --all | - git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | + git cat-file \ + --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | - $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest + $(command -v gnumfmt || echo numfmt) \ + --field=2 \ + --to=iec-i \ + --suffix=B \ + --padding=7 \ + --round=nearest } + +if command-exists difft; then + export GIT_EXTERNAL_DIFF=difft +fi