summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authornin <nineinchnade@gmail.com>2017-10-20 22:10:49 +0200
committernin <nineinchnade@gmail.com>2017-10-20 22:10:49 +0200
commit506c9ee6c1633f1d2b85aaac20915d7c33f67e7e (patch)
tree959d43238110c8d24ec9de095189d9dab09f9e30 /krebs/5pkgs/simple
parent10850a202732728f4b95da7208005617606c2062 (diff)
parent9064b8e5ce92c3380b8765d55e5ba722361286aa (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/Reaktor/plugins.nix3
-rw-r--r--krebs/5pkgs/simple/git-preview/default.nix25
2 files changed, 15 insertions, 13 deletions
diff --git a/krebs/5pkgs/simple/Reaktor/plugins.nix b/krebs/5pkgs/simple/Reaktor/plugins.nix
index c611d7471..518e80d0e 100644
--- a/krebs/5pkgs/simple/Reaktor/plugins.nix
+++ b/krebs/5pkgs/simple/Reaktor/plugins.nix
@@ -144,7 +144,8 @@ rec {
'';
};
wiki-todo-show = buildSimpleReaktorPlugin "wiki-todo" {
- script = pkgs.writeDash "wiki-todo-add" ''
+ pattern = "^wiki-show$";
+ script = pkgs.writeDash "wiki-show" ''
${pkgs.coreutils}/bin/cat wiki-todo
'';
};
diff --git a/krebs/5pkgs/simple/git-preview/default.nix b/krebs/5pkgs/simple/git-preview/default.nix
index f20f2a636..77826f34b 100644
--- a/krebs/5pkgs/simple/git-preview/default.nix
+++ b/krebs/5pkgs/simple/git-preview/default.nix
@@ -1,15 +1,16 @@
-{ coreutils, git, stdenv, writeDashBin }:
+{ coreutils, git, 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" "$@"
+ set -efu
+ head_commit=$(${git}/bin/git log -1 --format=%H)
+ merge_commit=$1; shift
+ merge_message='Merge for git-preview'
+ preview_dir=$(${coreutils}/bin/mktemp --tmpdir -d git-preview.XXXXXXXX)
+ preview_name=$(${coreutils}/bin/basename "$preview_dir")
+ ${git}/bin/git worktree add --detach -f "$preview_dir" 2>/dev/null
+ ${git}/bin/git -C "$preview_dir" checkout -q "$head_commit"
+ ${git}/bin/git -C "$preview_dir" merge -qm "$merge_message" "$merge_commit"
+ ${git}/bin/git -C "$preview_dir" diff "$head_commit.." "$@"
+ ${coreutils}/bin/rm -fR "$preview_dir"
+ ${coreutils}/bin/rm -R .git/worktrees/"$preview_name"
''