git-preview: init

This commit is contained in:
lassulus 2017-09-21 23:36:34 +02:00
parent 0075549f34
commit 457f2f1345

View File

@ -0,0 +1,15 @@
{ coreutils, git, stdenv, writeDashBin }:
writeDashBin "git-preview" ''
PATH=${stdenv.lib.makeBinPath [
coreutils
git
]}''${PATH+:$PATH}
hashes=$(git log --format=%h "..$1")
end=$(echo "$hashes" | head -1)
start=$(echo "$hashes" | tail -1)
# exit if no diff was found
test -z "$start" && exit 0
shift
git diff "$start^..$end" "$@"
''