diff options
author | lassulus <lassulus@lassul.us> | 2017-10-01 17:54:06 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2017-10-01 17:54:06 +0200 |
commit | d7f65ea679866f24e4ca52b51bd6f068a6b38195 (patch) | |
tree | 6a09e7cc2a4c9af0507bdc189652c78832a2f952 /krebs/5pkgs/simple/git-preview/default.nix | |
parent | d973c779eb71749af464edb1ed0216b0d5317eb2 (diff) | |
parent | e62f376e6177f3efb0e0bcd3aad97a991c3b6d60 (diff) |
Merge branch 'master' into staging/17.09
Diffstat (limited to 'krebs/5pkgs/simple/git-preview/default.nix')
-rw-r--r-- | krebs/5pkgs/simple/git-preview/default.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/git-preview/default.nix b/krebs/5pkgs/simple/git-preview/default.nix new file mode 100644 index 000000000..f20f2a636 --- /dev/null +++ b/krebs/5pkgs/simple/git-preview/default.nix @@ -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" "$@" +'' |