From 110a64cb9464f7bf772f68b775517a6b106160ec Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 13 Mar 2019 21:37:46 +0000 Subject: modules/git: add mozlz4 textconv --- modules/shell/git/attributes | 1 + modules/shell/git/config.in | 2 ++ modules/shell/git/default.nix | 9 +++++++++ modules/shell/git/diff/mozlz4.in | 4 ++++ 4 files changed, 16 insertions(+) create mode 100644 modules/shell/git/diff/mozlz4.in (limited to 'modules/shell') 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 -- cgit 1.4.1