summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/git-preview
diff options
context:
space:
mode:
authornin <nineinchnade@gmail.com>2017-09-29 19:11:43 +0200
committernin <nineinchnade@gmail.com>2017-09-29 19:11:43 +0200
commitf4bf9110727f2c7113c80aaa88427b81605016ae (patch)
treea56a491867eeb0deaca97c7ff272d563a026ec5c /krebs/5pkgs/simple/git-preview
parent7a7d085d33e1aa8e97f9f91d0fe53a1e378ce75e (diff)
parent6dfe071664136790b7d62bf062e090722997372f (diff)
Merge branch 'master' of prism:stockholm
Diffstat (limited to 'krebs/5pkgs/simple/git-preview')
-rw-r--r--krebs/5pkgs/simple/git-preview/default.nix15
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" "$@"
+''