blob: f20f2a636d42f5196fb6553aefa1adfb907ec257 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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" "$@"
''
|