about summary refs log tree commit diff
path: root/modules/shell
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-03-13 21:37:46 +0000
committerAlyssa Ross <hi@alyssa.is>2019-03-13 21:37:46 +0000
commit110a64cb9464f7bf772f68b775517a6b106160ec (patch)
tree69ca2a469610a06b697d08de65ba506fe62d65a3 /modules/shell
parentf3b8160f2c87a5021b7c0c99a654f4279e5289f5 (diff)
downloadnixlib-110a64cb9464f7bf772f68b775517a6b106160ec.tar
nixlib-110a64cb9464f7bf772f68b775517a6b106160ec.tar.gz
nixlib-110a64cb9464f7bf772f68b775517a6b106160ec.tar.bz2
nixlib-110a64cb9464f7bf772f68b775517a6b106160ec.tar.lz
nixlib-110a64cb9464f7bf772f68b775517a6b106160ec.tar.xz
nixlib-110a64cb9464f7bf772f68b775517a6b106160ec.tar.zst
nixlib-110a64cb9464f7bf772f68b775517a6b106160ec.zip
modules/git: add mozlz4 textconv
Diffstat (limited to 'modules/shell')
-rw-r--r--modules/shell/git/attributes1
-rw-r--r--modules/shell/git/config.in2
-rw-r--r--modules/shell/git/default.nix9
-rw-r--r--modules/shell/git/diff/mozlz4.in4
4 files changed, 16 insertions, 0 deletions
diff --git a/modules/shell/git/attributes b/modules/shell/git/attributes
index 51037ea8c46a..24cb25b10aa7 100644
--- a/modules/shell/git/attributes
+++ b/modules/shell/git/attributes
@@ -1,2 +1,3 @@
 *.json diff=json
 *.plist diff=plist
+*.json.mozlz4 diff=mozlz4
diff --git a/modules/shell/git/config.in b/modules/shell/git/config.in
index ee4dcef4c1e1..8ebb86a32910 100644
--- a/modules/shell/git/config.in
+++ b/modules/shell/git/config.in
@@ -43,6 +43,8 @@
     autosetuprebase = always
 [diff "json"]
     textconv = @python@/bin/python -m json.tool
+[diff "mozlz4"]
+    textconv = @mozlz4_textconv@
 [diff "plist"]
     textconv = /usr/bin/plutil -convert xml1 -o -
 [format]
diff --git a/modules/shell/git/default.nix b/modules/shell/git/default.nix
index 1257752e9967..a840a52f0cfe 100644
--- a/modules/shell/git/default.nix
+++ b/modules/shell/git/default.nix
@@ -1,7 +1,16 @@
 { pkgs, ... }:
 
 let
+  mozlz4_textconv = pkgs.runCommand "mozlz4-textconv" {
+    inherit (pkgs) execline mozlz4a;
+    python = pkgs.python3;
+  } ''
+    substituteAll ${diff/mozlz4.in} $out
+    chmod +x $out
+  '';
+
   config = pkgs.runCommand "gitconfig" {
+    inherit mozlz4_textconv;
     python = pkgs.python3;
     attributesfile = ./attributes;
     ignorefile = ./ignore;
diff --git a/modules/shell/git/diff/mozlz4.in b/modules/shell/git/diff/mozlz4.in
new file mode 100644
index 000000000000..4377e69526c7
--- /dev/null
+++ b/modules/shell/git/diff/mozlz4.in
@@ -0,0 +1,4 @@
+#! @execline@/bin/execlineb -S1
+
+pipeline { @mozlz4a@/bin/mozlz4a -d $1 /dev/stdout }
+@python@/bin/python -m json.tool