git-preview: init
This commit is contained in:
parent
0075549f34
commit
457f2f1345
15
krebs/5pkgs/simple/git-preview/default.nix
Normal file
15
krebs/5pkgs/simple/git-preview/default.nix
Normal 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" "$@"
|
||||
''
|
Loading…
Reference in New Issue
Block a user