terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

different strat

+271 -2057
+6 -1
dune-project
··· 20 20 (synopsis "A short synopsis") 21 21 (description "A longer description") 22 22 (depends 23 - ocaml dune stdio nottui lwd base eio_main angstrom ppx_expect ppx_jane) 23 + ocaml dune stdio nottui lwd base eio_main angstrom ppx_expect ppx_jane 24 + lwd 25 + eio-process 26 + notty 27 + 28 + ) 24 29 (tags 25 30 (topics "to describe" your project))) 26 31
+58
flake-old.nix
··· 1 + { 2 + inputs = { 3 + opam-nix.url = "github:tweag/opam-nix"; 4 + flake-utils.url = "github:numtide/flake-utils"; 5 + nixpkgs.follows = "opam-nix/nixpkgs"; 6 + }; 7 + outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs: 8 + flake-utils.lib.eachDefaultSystem (system: 9 + let 10 + pkgs = nixpkgs.legacyPackages.${system}; 11 + on = opam-nix.lib.${system}; 12 + localPackagesQuery = builtins.mapAttrs (_: pkgs.lib.last) 13 + (on.listRepo (on.makeOpamRepo ./.)); 14 + devPackagesQuery = { 15 + # You can add "development" packages here. They will get added to the devShell automatically. 16 + ocaml-lsp-server = "*"; 17 + ocamlformat = "*"; 18 + }; 19 + query = devPackagesQuery // { 20 + ## You can force versions of certain packages here, e.g: 21 + ## - force the ocaml compiler to be taken from opam-repository: 22 + # ocaml-base-compiler = "5.1.0"; 23 + ## - or force the compiler to be taken from nixpkgs and be a certain version: 24 + # ocaml-system = "5.1.0"; 25 + ## - or force ocamlfind to be a certain version: 26 + # ocamlfind = "1.9.2"; 27 + }; 28 + scope = on.buildOpamProject' { 29 + 30 + pkgs=pkgs.pkgsStatic; 31 + } ./. query; 32 + overlay = final: prev: 33 + { 34 + # You can add overrides here 35 + }; 36 + scope' = scope.overrideScope' overlay; 37 + # Packages from devPackagesQuery 38 + devPackages = builtins.attrValues 39 + (pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope'); 40 + # Packages in this workspace 41 + packages = 42 + pkgs.lib.getAttrs (builtins.attrNames localPackagesQuery) scope'; 43 + in { 44 + legacyPackages = scope'; 45 + 46 + # inherit packages; 47 + 48 + ## If you want to have a "default" package which will be built with just `nix build`, do this instead of `inherit packages;`: 49 + packages = packages // { default = packages.jj_tui; }; 50 + 51 + devShells.default = pkgs.mkShell { 52 + inputsFrom = builtins.attrValues packages; 53 + buildInputs = devPackages ++ [ 54 + # You can add packages from nixpkgs here 55 + ]; 56 + }; 57 + }); 58 + }
+8 -173
flake.lock
··· 1 1 { 2 2 "nodes": { 3 - "flake-compat": { 4 - "flake": false, 5 - "locked": { 6 - "lastModified": 1627913399, 7 - "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", 8 - "owner": "edolstra", 9 - "repo": "flake-compat", 10 - "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", 11 - "type": "github" 12 - }, 13 - "original": { 14 - "owner": "edolstra", 15 - "repo": "flake-compat", 16 - "type": "github" 17 - } 18 - }, 19 - "flake-utils": { 20 - "inputs": { 21 - "systems": "systems" 22 - }, 23 - "locked": { 24 - "lastModified": 1710146030, 25 - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", 26 - "owner": "numtide", 27 - "repo": "flake-utils", 28 - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", 29 - "type": "github" 30 - }, 31 - "original": { 32 - "owner": "numtide", 33 - "repo": "flake-utils", 34 - "type": "github" 35 - } 36 - }, 37 - "flake-utils_2": { 38 - "locked": { 39 - "lastModified": 1638122382, 40 - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", 41 - "owner": "numtide", 42 - "repo": "flake-utils", 43 - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", 44 - "type": "github" 45 - }, 46 - "original": { 47 - "owner": "numtide", 48 - "repo": "flake-utils", 49 - "type": "github" 50 - } 51 - }, 52 - "mirage-opam-overlays": { 53 - "flake": false, 54 - "locked": { 55 - "lastModified": 1661959605, 56 - "narHash": "sha256-CPTuhYML3F4J58flfp3ZbMNhkRkVFKmBEYBZY5tnQwA=", 57 - "owner": "dune-universe", 58 - "repo": "mirage-opam-overlays", 59 - "rev": "05f1c1823d891ce4d8adab91f5db3ac51d86dc0b", 60 - "type": "github" 61 - }, 62 - "original": { 63 - "owner": "dune-universe", 64 - "repo": "mirage-opam-overlays", 65 - "type": "github" 66 - } 67 - }, 68 3 "nixpkgs": { 69 4 "locked": { 70 - "lastModified": 1682362401, 71 - "narHash": "sha256-/UMUHtF2CyYNl4b60Z2y4wwTTdIWGKhj9H301EDcT9M=", 72 - "owner": "nixos", 73 - "repo": "nixpkgs", 74 - "rev": "884ac294018409e0d1adc0cae185439a44bd6b0b", 75 - "type": "github" 5 + "lastModified": 1713537308, 6 + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", 7 + "path": "/nix/store/v4pcs3nzx54m5bmxd39win0rgl2d2hbx-source", 8 + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", 9 + "type": "path" 76 10 }, 77 11 "original": { 78 - "owner": "nixos", 79 - "ref": "nixos-unstable", 80 - "repo": "nixpkgs", 81 - "type": "github" 82 - } 83 - }, 84 - "opam-nix": { 85 - "inputs": { 86 - "flake-compat": "flake-compat", 87 - "flake-utils": "flake-utils_2", 88 - "mirage-opam-overlays": "mirage-opam-overlays", 89 - "nixpkgs": "nixpkgs", 90 - "opam-overlays": "opam-overlays", 91 - "opam-repository": "opam-repository", 92 - "opam2json": "opam2json" 93 - }, 94 - "locked": { 95 - "lastModified": 1715087815, 96 - "narHash": "sha256-FjIg+rO+aIfVFzSbvNznVhCn/s2MS8HkPhht7LqzLlk=", 97 - "owner": "tweag", 98 - "repo": "opam-nix", 99 - "rev": "d42a3b8f234dd8c922020f8b2f4e326406bf23d1", 100 - "type": "github" 101 - }, 102 - "original": { 103 - "owner": "tweag", 104 - "repo": "opam-nix", 105 - "type": "github" 106 - } 107 - }, 108 - "opam-overlays": { 109 - "flake": false, 110 - "locked": { 111 - "lastModified": 1654162756, 112 - "narHash": "sha256-RV68fUK+O3zTx61iiHIoS0LvIk0E4voMp+0SwRg6G6c=", 113 - "owner": "dune-universe", 114 - "repo": "opam-overlays", 115 - "rev": "c8f6ef0fc5272f254df4a971a47de7848cc1c8a4", 116 - "type": "github" 117 - }, 118 - "original": { 119 - "owner": "dune-universe", 120 - "repo": "opam-overlays", 121 - "type": "github" 122 - } 123 - }, 124 - "opam-repository": { 125 - "flake": false, 126 - "locked": { 127 - "lastModified": 1705008664, 128 - "narHash": "sha256-TTjTal49QK2U0yVOmw6rJhTGYM7tnj3Kv9DiEEiLt7E=", 129 - "owner": "ocaml", 130 - "repo": "opam-repository", 131 - "rev": "fa77046c6497f8ca32926acdb7eb1e61777d4c17", 132 - "type": "github" 133 - }, 134 - "original": { 135 - "owner": "ocaml", 136 - "repo": "opam-repository", 137 - "type": "github" 138 - } 139 - }, 140 - "opam2json": { 141 - "inputs": { 142 - "nixpkgs": [ 143 - "opam-nix", 144 - "nixpkgs" 145 - ] 146 - }, 147 - "locked": { 148 - "lastModified": 1671540003, 149 - "narHash": "sha256-5pXfbUfpVABtKbii6aaI2EdAZTjHJ2QntEf0QD2O5AM=", 150 - "owner": "tweag", 151 - "repo": "opam2json", 152 - "rev": "819d291ea95e271b0e6027679de6abb4d4f7f680", 153 - "type": "github" 154 - }, 155 - "original": { 156 - "owner": "tweag", 157 - "repo": "opam2json", 158 - "type": "github" 12 + "id": "nixpkgs-unstable", 13 + "type": "indirect" 159 14 } 160 15 }, 161 16 "root": { 162 17 "inputs": { 163 - "flake-utils": "flake-utils", 164 - "nixpkgs": [ 165 - "opam-nix", 166 - "nixpkgs" 167 - ], 168 - "opam-nix": "opam-nix" 169 - } 170 - }, 171 - "systems": { 172 - "locked": { 173 - "lastModified": 1681028828, 174 - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 175 - "owner": "nix-systems", 176 - "repo": "default", 177 - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 178 - "type": "github" 179 - }, 180 - "original": { 181 - "owner": "nix-systems", 182 - "repo": "default", 183 - "type": "github" 18 + "nixpkgs": "nixpkgs" 184 19 } 185 20 } 186 21 },
+133 -48
flake.nix
··· 1 1 { 2 + description = "Example JavaScript development environment for Zero to Nix"; 3 + 4 + # Flake inputs 2 5 inputs = { 3 - opam-nix.url = "github:tweag/opam-nix"; 4 - flake-utils.url = "github:numtide/flake-utils"; 5 - nixpkgs.follows = "opam-nix/nixpkgs"; 6 + 7 + nixpkgs.url = "nixpkgs-unstable"; # also valid: "nixpkgs" 8 + 6 9 }; 7 - outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs: 8 - flake-utils.lib.eachDefaultSystem (system: 9 - let 10 - pkgs = nixpkgs.legacyPackages.${system}; 11 - on = opam-nix.lib.${system}; 12 - localPackagesQuery = builtins.mapAttrs (_: pkgs.lib.last) 13 - (on.listRepo (on.makeOpamRepo ./.)); 14 - devPackagesQuery = { 15 - # You can add "development" packages here. They will get added to the devShell automatically. 16 - ocaml-lsp-server = "*"; 17 - ocamlformat = "*"; 18 - }; 19 - query = devPackagesQuery // { 20 - ## You can force versions of certain packages here, e.g: 21 - ## - force the ocaml compiler to be taken from opam-repository: 22 - # ocaml-base-compiler = "5.1.0"; 23 - ## - or force the compiler to be taken from nixpkgs and be a certain version: 24 - # ocaml-system = "5.1.0"; 25 - ## - or force ocamlfind to be a certain version: 26 - # ocamlfind = "1.9.2"; 27 - }; 28 - scope = on.buildOpamProject' { 10 + # Flake outputs 11 + outputs = { self, nixpkgs, ... }@inputs: 12 + let 13 + # Systems supported 14 + allSystems = 15 + [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; 16 + 17 + # Helper to provide system-specific attributes 18 + forAllSystems = f: 19 + nixpkgs.lib.genAttrs allSystems (system: 20 + f (let pkgs = import nixpkgs { inherit system; }; 21 + in { 22 + pkgs = pkgs; 23 + # OCaml packages available on nixpkgs 24 + ocamlPackages = 25 + nixpkgs.legacyPackages.${system}.ocamlPackages; # Legacy packages that have not been converted to flakes 26 + ocamlPackagesStatic = 27 + nixpkgs.legacyPackages.${system}.pkgsMusl.ocamlPackages; # Legacy packages that have not been converted to flakes 28 + })); 29 + 30 + in { 31 + packages = forAllSystems ({ pkgs, ocamlPackages,ocamlPackagesStatic}: 32 + let 33 + eio-process = ocamlPackages.buildDunePackage { 34 + pname = "eio-process"; 35 + version = "0.1.0"; 36 + duneVersion = "3"; 37 + src = pkgs.fetchFromGitHub { 38 + 39 + owner = "mbarbin"; 40 + repo = "eio-process"; 41 + rev = "482ba341884dc8711f93ec9cc6d7c941099e0faa"; 42 + sha256 = "sha256-/Y2U+1y+nDMBrRfDAYif0WJp0vPWmvbSMt39wAB/rS8="; 43 + }; 44 + nativeBuildInputs = with pkgs; 45 + [ 46 + # gmp 47 + # stdenv.cc.cc.lib 48 + # dune_3 49 + # clang 50 + # ocaml 51 + # opam 52 + 53 + ]; 54 + 55 + buildInputs = with ocamlPackages; [ 56 + base 57 + eio 58 + parsexp 59 + ppx_compare 60 + ppx_enumerate 61 + ppx_hash 62 + ppx_here 63 + ppx_let 64 + ppx_sexp_conv 65 + ppx_sexp_value 66 + ]; 67 + 68 + strictDeps = true; 69 + 70 + preBuild = '' 71 + #make home which is needed for opam 72 + # export HOME=$(pwd)/build-home 73 + # mkdir -p $HOME 74 + 75 + # opam init . 76 + 77 + # opam install . opam-monorepo 78 + # opam monorepo pull 79 + ''; 80 + }; 81 + jj_tui= pkgs: ocamlPackages: 82 + ocamlPackages.buildDunePackage { 83 + pname = "jj_tui"; 84 + version = "0.1.0"; 85 + duneVersion = "3"; 86 + src = ./.; 87 + 88 + buildInputs = [ 89 + eio-process 90 + ocamlPackages.parsexp 91 + ocamlPackages.eio_main 92 + ocamlPackages.stdio 93 + ocamlPackages.nottui 94 + ocamlPackages.lwd 95 + ocamlPackages.base 96 + ocamlPackages.angstrom 97 + ocamlPackages.ppx_expect 98 + # ocamlPackages.parsexp 99 + 100 + # Ocaml package dependencies needed to build go here. 101 + ]; 102 + env={ 103 + DUNE_PROFILE="static"; 104 + 105 + }; 106 + 107 + strictDeps = true; 29 108 30 - pkgs=pkgs.pkgsStatic; 31 - } ./. query; 32 - overlay = final: prev: 33 - { 34 - # You can add overrides here 109 + preBuild = '' 110 + #make home which is needed for opam 111 + # export HOME=$(pwd)/build-home 112 + # mkdir -p $HOME 113 + 114 + export DUNE_PROFILE=static 115 + # opam init . 116 + 117 + # opam install . opam-monorepo 118 + # opam monorepo pull 119 + ''; 35 120 }; 36 - scope' = scope.overrideScope' overlay; 37 - # Packages from devPackagesQuery 38 - devPackages = builtins.attrValues 39 - (pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope'); 40 - # Packages in this workspace 41 - packages = 42 - pkgs.lib.getAttrs (builtins.attrNames localPackagesQuery) scope'; 43 - in { 44 - legacyPackages = scope'; 45 121 46 - # inherit packages; 122 + in { 123 + default =jj_tui pkgs ocamlPackages; # Development environment output 124 + pkgsMusl.default=jj_tui pkgs.pkgsMusl ocamlPackagesStatic; # Development environment output 125 + }); 126 + devShells = forAllSystems ({ pkgs, ... }: { 127 + default = 47 128 48 - ## If you want to have a "default" package which will be built with just `nix build`, do this instead of `inherit packages;`: 49 - packages = packages // { default = packages.jj_tui; }; 129 + pkgs.mkShell { 130 + packages = with pkgs; [ 131 + gmp 132 + stdenv.cc.cc.lib 133 + dune_3 134 + ocaml 135 + opam 136 + fish 137 + ]; 138 + }; 50 139 51 - devShells.default = pkgs.mkShell { 52 - inputsFrom = builtins.attrValues packages; 53 - buildInputs = devPackages ++ [ 54 - # You can add packages from nixpkgs here 55 - ]; 56 - }; 57 140 }); 141 + 142 + }; 58 143 }
-1
forks/eio-process/.git_/HEAD
··· 1 - ref: refs/heads/main
-11
forks/eio-process/.git_/config
··· 1 - [core] 2 - repositoryformatversion = 0 3 - filemode = true 4 - bare = false 5 - logallrefupdates = true 6 - [remote "origin"] 7 - url = git@github.com:mbarbin/eio-process.git 8 - fetch = +refs/heads/*:refs/remotes/origin/* 9 - [branch "main"] 10 - remote = origin 11 - merge = refs/heads/main
-1
forks/eio-process/.git_/description
··· 1 - Unnamed repository; edit this file 'description' to name the repository.
-15
forks/eio-process/.git_/hooks/applypatch-msg.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to check the commit log message taken by 4 - # applypatch from an e-mail message. 5 - # 6 - # The hook should exit with non-zero status after issuing an 7 - # appropriate message if it wants to stop the commit. The hook is 8 - # allowed to edit the commit message file. 9 - # 10 - # To enable this hook, rename this file to "applypatch-msg". 11 - 12 - . git-sh-setup 13 - commitmsg="$(git rev-parse --git-path hooks/commit-msg)" 14 - test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} 15 - :
-24
forks/eio-process/.git_/hooks/commit-msg.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to check the commit log message. 4 - # Called by "git commit" with one argument, the name of the file 5 - # that has the commit message. The hook should exit with non-zero 6 - # status after issuing an appropriate message if it wants to stop the 7 - # commit. The hook is allowed to edit the commit message file. 8 - # 9 - # To enable this hook, rename this file to "commit-msg". 10 - 11 - # Uncomment the below to add a Signed-off-by line to the message. 12 - # Doing this in a hook is a bad idea in general, but the prepare-commit-msg 13 - # hook is more suited to it. 14 - # 15 - # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 16 - # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 17 - 18 - # This example catches duplicate Signed-off-by lines. 19 - 20 - test "" = "$(grep '^Signed-off-by: ' "$1" | 21 - sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { 22 - echo >&2 Duplicate Signed-off-by lines. 23 - exit 1 24 - }
-174
forks/eio-process/.git_/hooks/fsmonitor-watchman.sample
··· 1 - #!/nix/store/40rr7blrifwcfzxih97y79qvh07ycakh-perl-5.38.2/bin/perl 2 - 3 - use strict; 4 - use warnings; 5 - use IPC::Open2; 6 - 7 - # An example hook script to integrate Watchman 8 - # (https://facebook.github.io/watchman/) with git to speed up detecting 9 - # new and modified files. 10 - # 11 - # The hook is passed a version (currently 2) and last update token 12 - # formatted as a string and outputs to stdout a new update token and 13 - # all files that have been modified since the update token. Paths must 14 - # be relative to the root of the working tree and separated by a single NUL. 15 - # 16 - # To enable this hook, rename this file to "query-watchman" and set 17 - # 'git config core.fsmonitor .git/hooks/query-watchman' 18 - # 19 - my ($version, $last_update_token) = @ARGV; 20 - 21 - # Uncomment for debugging 22 - # print STDERR "$0 $version $last_update_token\n"; 23 - 24 - # Check the hook interface version 25 - if ($version ne 2) { 26 - die "Unsupported query-fsmonitor hook version '$version'.\n" . 27 - "Falling back to scanning...\n"; 28 - } 29 - 30 - my $git_work_tree = get_working_dir(); 31 - 32 - my $retry = 1; 33 - 34 - my $json_pkg; 35 - eval { 36 - require JSON::XS; 37 - $json_pkg = "JSON::XS"; 38 - 1; 39 - } or do { 40 - require JSON::PP; 41 - $json_pkg = "JSON::PP"; 42 - }; 43 - 44 - launch_watchman(); 45 - 46 - sub launch_watchman { 47 - my $o = watchman_query(); 48 - if (is_work_tree_watched($o)) { 49 - output_result($o->{clock}, @{$o->{files}}); 50 - } 51 - } 52 - 53 - sub output_result { 54 - my ($clockid, @files) = @_; 55 - 56 - # Uncomment for debugging watchman output 57 - # open (my $fh, ">", ".git/watchman-output.out"); 58 - # binmode $fh, ":utf8"; 59 - # print $fh "$clockid\n@files\n"; 60 - # close $fh; 61 - 62 - binmode STDOUT, ":utf8"; 63 - print $clockid; 64 - print "\0"; 65 - local $, = "\0"; 66 - print @files; 67 - } 68 - 69 - sub watchman_clock { 70 - my $response = qx/watchman clock "$git_work_tree"/; 71 - die "Failed to get clock id on '$git_work_tree'.\n" . 72 - "Falling back to scanning...\n" if $? != 0; 73 - 74 - return $json_pkg->new->utf8->decode($response); 75 - } 76 - 77 - sub watchman_query { 78 - my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') 79 - or die "open2() failed: $!\n" . 80 - "Falling back to scanning...\n"; 81 - 82 - # In the query expression below we're asking for names of files that 83 - # changed since $last_update_token but not from the .git folder. 84 - # 85 - # To accomplish this, we're using the "since" generator to use the 86 - # recency index to select candidate nodes and "fields" to limit the 87 - # output to file names only. Then we're using the "expression" term to 88 - # further constrain the results. 89 - my $last_update_line = ""; 90 - if (substr($last_update_token, 0, 1) eq "c") { 91 - $last_update_token = "\"$last_update_token\""; 92 - $last_update_line = qq[\n"since": $last_update_token,]; 93 - } 94 - my $query = <<" END"; 95 - ["query", "$git_work_tree", {$last_update_line 96 - "fields": ["name"], 97 - "expression": ["not", ["dirname", ".git"]] 98 - }] 99 - END 100 - 101 - # Uncomment for debugging the watchman query 102 - # open (my $fh, ">", ".git/watchman-query.json"); 103 - # print $fh $query; 104 - # close $fh; 105 - 106 - print CHLD_IN $query; 107 - close CHLD_IN; 108 - my $response = do {local $/; <CHLD_OUT>}; 109 - 110 - # Uncomment for debugging the watch response 111 - # open ($fh, ">", ".git/watchman-response.json"); 112 - # print $fh $response; 113 - # close $fh; 114 - 115 - die "Watchman: command returned no output.\n" . 116 - "Falling back to scanning...\n" if $response eq ""; 117 - die "Watchman: command returned invalid output: $response\n" . 118 - "Falling back to scanning...\n" unless $response =~ /^\{/; 119 - 120 - return $json_pkg->new->utf8->decode($response); 121 - } 122 - 123 - sub is_work_tree_watched { 124 - my ($output) = @_; 125 - my $error = $output->{error}; 126 - if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { 127 - $retry--; 128 - my $response = qx/watchman watch "$git_work_tree"/; 129 - die "Failed to make watchman watch '$git_work_tree'.\n" . 130 - "Falling back to scanning...\n" if $? != 0; 131 - $output = $json_pkg->new->utf8->decode($response); 132 - $error = $output->{error}; 133 - die "Watchman: $error.\n" . 134 - "Falling back to scanning...\n" if $error; 135 - 136 - # Uncomment for debugging watchman output 137 - # open (my $fh, ">", ".git/watchman-output.out"); 138 - # close $fh; 139 - 140 - # Watchman will always return all files on the first query so 141 - # return the fast "everything is dirty" flag to git and do the 142 - # Watchman query just to get it over with now so we won't pay 143 - # the cost in git to look up each individual file. 144 - my $o = watchman_clock(); 145 - $error = $output->{error}; 146 - 147 - die "Watchman: $error.\n" . 148 - "Falling back to scanning...\n" if $error; 149 - 150 - output_result($o->{clock}, ("/")); 151 - $last_update_token = $o->{clock}; 152 - 153 - eval { launch_watchman() }; 154 - return 0; 155 - } 156 - 157 - die "Watchman: $error.\n" . 158 - "Falling back to scanning...\n" if $error; 159 - 160 - return 1; 161 - } 162 - 163 - sub get_working_dir { 164 - my $working_dir; 165 - if ($^O =~ 'msys' || $^O =~ 'cygwin') { 166 - $working_dir = Win32::GetCwd(); 167 - $working_dir =~ tr/\\/\//; 168 - } else { 169 - require Cwd; 170 - $working_dir = Cwd::cwd(); 171 - } 172 - 173 - return $working_dir; 174 - }
-8
forks/eio-process/.git_/hooks/post-update.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to prepare a packed repository for use over 4 - # dumb transports. 5 - # 6 - # To enable this hook, rename this file to "post-update". 7 - 8 - exec git update-server-info
-14
forks/eio-process/.git_/hooks/pre-applypatch.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to verify what is about to be committed 4 - # by applypatch from an e-mail message. 5 - # 6 - # The hook should exit with non-zero status after issuing an 7 - # appropriate message if it wants to stop the commit. 8 - # 9 - # To enable this hook, rename this file to "pre-applypatch". 10 - 11 - . git-sh-setup 12 - precommit="$(git rev-parse --git-path hooks/pre-commit)" 13 - test -x "$precommit" && exec "$precommit" ${1+"$@"} 14 - :
-49
forks/eio-process/.git_/hooks/pre-commit.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to verify what is about to be committed. 4 - # Called by "git commit" with no arguments. The hook should 5 - # exit with non-zero status after issuing an appropriate message if 6 - # it wants to stop the commit. 7 - # 8 - # To enable this hook, rename this file to "pre-commit". 9 - 10 - if git rev-parse --verify HEAD >/dev/null 2>&1 11 - then 12 - against=HEAD 13 - else 14 - # Initial commit: diff against an empty tree object 15 - against=$(git hash-object -t tree /dev/null) 16 - fi 17 - 18 - # If you want to allow non-ASCII filenames set this variable to true. 19 - allownonascii=$(git config --type=bool hooks.allownonascii) 20 - 21 - # Redirect output to stderr. 22 - exec 1>&2 23 - 24 - # Cross platform projects tend to avoid non-ASCII filenames; prevent 25 - # them from being added to the repository. We exploit the fact that the 26 - # printable range starts at the space character and ends with tilde. 27 - if [ "$allownonascii" != "true" ] && 28 - # Note that the use of brackets around a tr range is ok here, (it's 29 - # even required, for portability to Solaris 10's /usr/bin/tr), since 30 - # the square bracket bytes happen to fall in the designated range. 31 - test $(git diff --cached --name-only --diff-filter=A -z $against | 32 - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 33 - then 34 - cat <<\EOF 35 - Error: Attempt to add a non-ASCII file name. 36 - 37 - This can cause problems if you want to work with people on other platforms. 38 - 39 - To be portable it is advisable to rename the file. 40 - 41 - If you know what you are doing you can disable this check using: 42 - 43 - git config hooks.allownonascii true 44 - EOF 45 - exit 1 46 - fi 47 - 48 - # If there are whitespace errors, print the offending file names and fail. 49 - exec git diff-index --check --cached $against --
-13
forks/eio-process/.git_/hooks/pre-merge-commit.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to verify what is about to be committed. 4 - # Called by "git merge" with no arguments. The hook should 5 - # exit with non-zero status after issuing an appropriate message to 6 - # stderr if it wants to stop the merge commit. 7 - # 8 - # To enable this hook, rename this file to "pre-merge-commit". 9 - 10 - . git-sh-setup 11 - test -x "$GIT_DIR/hooks/pre-commit" && 12 - exec "$GIT_DIR/hooks/pre-commit" 13 - :
-53
forks/eio-process/.git_/hooks/pre-push.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - 3 - # An example hook script to verify what is about to be pushed. Called by "git 4 - # push" after it has checked the remote status, but before anything has been 5 - # pushed. If this script exits with a non-zero status nothing will be pushed. 6 - # 7 - # This hook is called with the following parameters: 8 - # 9 - # $1 -- Name of the remote to which the push is being done 10 - # $2 -- URL to which the push is being done 11 - # 12 - # If pushing without using a named remote those arguments will be equal. 13 - # 14 - # Information about the commits which are being pushed is supplied as lines to 15 - # the standard input in the form: 16 - # 17 - # <local ref> <local oid> <remote ref> <remote oid> 18 - # 19 - # This sample shows how to prevent push of commits where the log message starts 20 - # with "WIP" (work in progress). 21 - 22 - remote="$1" 23 - url="$2" 24 - 25 - zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') 26 - 27 - while read local_ref local_oid remote_ref remote_oid 28 - do 29 - if test "$local_oid" = "$zero" 30 - then 31 - # Handle delete 32 - : 33 - else 34 - if test "$remote_oid" = "$zero" 35 - then 36 - # New branch, examine all commits 37 - range="$local_oid" 38 - else 39 - # Update to existing branch, examine new commits 40 - range="$remote_oid..$local_oid" 41 - fi 42 - 43 - # Check for WIP commit 44 - commit=$(git rev-list -n 1 --grep '^WIP' "$range") 45 - if test -n "$commit" 46 - then 47 - echo >&2 "Found WIP commit in $local_ref, not pushing" 48 - exit 1 49 - fi 50 - fi 51 - done 52 - 53 - exit 0
-169
forks/eio-process/.git_/hooks/pre-rebase.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # Copyright (c) 2006, 2008 Junio C Hamano 4 - # 5 - # The "pre-rebase" hook is run just before "git rebase" starts doing 6 - # its job, and can prevent the command from running by exiting with 7 - # non-zero status. 8 - # 9 - # The hook is called with the following parameters: 10 - # 11 - # $1 -- the upstream the series was forked from. 12 - # $2 -- the branch being rebased (or empty when rebasing the current branch). 13 - # 14 - # This sample shows how to prevent topic branches that are already 15 - # merged to 'next' branch from getting rebased, because allowing it 16 - # would result in rebasing already published history. 17 - 18 - publish=next 19 - basebranch="$1" 20 - if test "$#" = 2 21 - then 22 - topic="refs/heads/$2" 23 - else 24 - topic=`git symbolic-ref HEAD` || 25 - exit 0 ;# we do not interrupt rebasing detached HEAD 26 - fi 27 - 28 - case "$topic" in 29 - refs/heads/??/*) 30 - ;; 31 - *) 32 - exit 0 ;# we do not interrupt others. 33 - ;; 34 - esac 35 - 36 - # Now we are dealing with a topic branch being rebased 37 - # on top of master. Is it OK to rebase it? 38 - 39 - # Does the topic really exist? 40 - git show-ref -q "$topic" || { 41 - echo >&2 "No such branch $topic" 42 - exit 1 43 - } 44 - 45 - # Is topic fully merged to master? 46 - not_in_master=`git rev-list --pretty=oneline ^master "$topic"` 47 - if test -z "$not_in_master" 48 - then 49 - echo >&2 "$topic is fully merged to master; better remove it." 50 - exit 1 ;# we could allow it, but there is no point. 51 - fi 52 - 53 - # Is topic ever merged to next? If so you should not be rebasing it. 54 - only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` 55 - only_next_2=`git rev-list ^master ${publish} | sort` 56 - if test "$only_next_1" = "$only_next_2" 57 - then 58 - not_in_topic=`git rev-list "^$topic" master` 59 - if test -z "$not_in_topic" 60 - then 61 - echo >&2 "$topic is already up to date with master" 62 - exit 1 ;# we could allow it, but there is no point. 63 - else 64 - exit 0 65 - fi 66 - else 67 - not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` 68 - /nix/store/40rr7blrifwcfzxih97y79qvh07ycakh-perl-5.38.2/bin/perl -e ' 69 - my $topic = $ARGV[0]; 70 - my $msg = "* $topic has commits already merged to public branch:\n"; 71 - my (%not_in_next) = map { 72 - /^([0-9a-f]+) /; 73 - ($1 => 1); 74 - } split(/\n/, $ARGV[1]); 75 - for my $elem (map { 76 - /^([0-9a-f]+) (.*)$/; 77 - [$1 => $2]; 78 - } split(/\n/, $ARGV[2])) { 79 - if (!exists $not_in_next{$elem->[0]}) { 80 - if ($msg) { 81 - print STDERR $msg; 82 - undef $msg; 83 - } 84 - print STDERR " $elem->[1]\n"; 85 - } 86 - } 87 - ' "$topic" "$not_in_next" "$not_in_master" 88 - exit 1 89 - fi 90 - 91 - <<\DOC_END 92 - 93 - This sample hook safeguards topic branches that have been 94 - published from being rewound. 95 - 96 - The workflow assumed here is: 97 - 98 - * Once a topic branch forks from "master", "master" is never 99 - merged into it again (either directly or indirectly). 100 - 101 - * Once a topic branch is fully cooked and merged into "master", 102 - it is deleted. If you need to build on top of it to correct 103 - earlier mistakes, a new topic branch is created by forking at 104 - the tip of the "master". This is not strictly necessary, but 105 - it makes it easier to keep your history simple. 106 - 107 - * Whenever you need to test or publish your changes to topic 108 - branches, merge them into "next" branch. 109 - 110 - The script, being an example, hardcodes the publish branch name 111 - to be "next", but it is trivial to make it configurable via 112 - $GIT_DIR/config mechanism. 113 - 114 - With this workflow, you would want to know: 115 - 116 - (1) ... if a topic branch has ever been merged to "next". Young 117 - topic branches can have stupid mistakes you would rather 118 - clean up before publishing, and things that have not been 119 - merged into other branches can be easily rebased without 120 - affecting other people. But once it is published, you would 121 - not want to rewind it. 122 - 123 - (2) ... if a topic branch has been fully merged to "master". 124 - Then you can delete it. More importantly, you should not 125 - build on top of it -- other people may already want to 126 - change things related to the topic as patches against your 127 - "master", so if you need further changes, it is better to 128 - fork the topic (perhaps with the same name) afresh from the 129 - tip of "master". 130 - 131 - Let's look at this example: 132 - 133 - o---o---o---o---o---o---o---o---o---o "next" 134 - / / / / 135 - / a---a---b A / / 136 - / / / / 137 - / / c---c---c---c B / 138 - / / / \ / 139 - / / / b---b C \ / 140 - / / / / \ / 141 - ---o---o---o---o---o---o---o---o---o---o---o "master" 142 - 143 - 144 - A, B and C are topic branches. 145 - 146 - * A has one fix since it was merged up to "next". 147 - 148 - * B has finished. It has been fully merged up to "master" and "next", 149 - and is ready to be deleted. 150 - 151 - * C has not merged to "next" at all. 152 - 153 - We would want to allow C to be rebased, refuse A, and encourage 154 - B to be deleted. 155 - 156 - To compute (1): 157 - 158 - git rev-list ^master ^topic next 159 - git rev-list ^master next 160 - 161 - if these match, topic has not merged in next at all. 162 - 163 - To compute (2): 164 - 165 - git rev-list master..topic 166 - 167 - if this is empty, it is fully merged to "master". 168 - 169 - DOC_END
-24
forks/eio-process/.git_/hooks/pre-receive.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to make use of push options. 4 - # The example simply echoes all push options that start with 'echoback=' 5 - # and rejects all pushes when the "reject" push option is used. 6 - # 7 - # To enable this hook, rename this file to "pre-receive". 8 - 9 - if test -n "$GIT_PUSH_OPTION_COUNT" 10 - then 11 - i=0 12 - while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" 13 - do 14 - eval "value=\$GIT_PUSH_OPTION_$i" 15 - case "$value" in 16 - echoback=*) 17 - echo "echo from the pre-receive-hook: ${value#*=}" >&2 18 - ;; 19 - reject) 20 - exit 1 21 - esac 22 - i=$((i + 1)) 23 - done 24 - fi
-42
forks/eio-process/.git_/hooks/prepare-commit-msg.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to prepare the commit log message. 4 - # Called by "git commit" with the name of the file that has the 5 - # commit message, followed by the description of the commit 6 - # message's source. The hook's purpose is to edit the commit 7 - # message file. If the hook fails with a non-zero status, 8 - # the commit is aborted. 9 - # 10 - # To enable this hook, rename this file to "prepare-commit-msg". 11 - 12 - # This hook includes three examples. The first one removes the 13 - # "# Please enter the commit message..." help message. 14 - # 15 - # The second includes the output of "git diff --name-status -r" 16 - # into the message, just before the "git status" output. It is 17 - # commented because it doesn't cope with --amend or with squashed 18 - # commits. 19 - # 20 - # The third example adds a Signed-off-by line to the message, that can 21 - # still be edited. This is rarely a good idea. 22 - 23 - COMMIT_MSG_FILE=$1 24 - COMMIT_SOURCE=$2 25 - SHA1=$3 26 - 27 - /nix/store/40rr7blrifwcfzxih97y79qvh07ycakh-perl-5.38.2/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" 28 - 29 - # case "$COMMIT_SOURCE,$SHA1" in 30 - # ,|template,) 31 - # /nix/store/40rr7blrifwcfzxih97y79qvh07ycakh-perl-5.38.2/bin/perl -i.bak -pe ' 32 - # print "\n" . `git diff --cached --name-status -r` 33 - # if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; 34 - # *) ;; 35 - # esac 36 - 37 - # SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 38 - # git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" 39 - # if test -z "$COMMIT_SOURCE" 40 - # then 41 - # /nix/store/40rr7blrifwcfzxih97y79qvh07ycakh-perl-5.38.2/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" 42 - # fi
-78
forks/eio-process/.git_/hooks/push-to-checkout.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - 3 - # An example hook script to update a checked-out tree on a git push. 4 - # 5 - # This hook is invoked by git-receive-pack(1) when it reacts to git 6 - # push and updates reference(s) in its repository, and when the push 7 - # tries to update the branch that is currently checked out and the 8 - # receive.denyCurrentBranch configuration variable is set to 9 - # updateInstead. 10 - # 11 - # By default, such a push is refused if the working tree and the index 12 - # of the remote repository has any difference from the currently 13 - # checked out commit; when both the working tree and the index match 14 - # the current commit, they are updated to match the newly pushed tip 15 - # of the branch. This hook is to be used to override the default 16 - # behaviour; however the code below reimplements the default behaviour 17 - # as a starting point for convenient modification. 18 - # 19 - # The hook receives the commit with which the tip of the current 20 - # branch is going to be updated: 21 - commit=$1 22 - 23 - # It can exit with a non-zero status to refuse the push (when it does 24 - # so, it must not modify the index or the working tree). 25 - die () { 26 - echo >&2 "$*" 27 - exit 1 28 - } 29 - 30 - # Or it can make any necessary changes to the working tree and to the 31 - # index to bring them to the desired state when the tip of the current 32 - # branch is updated to the new commit, and exit with a zero status. 33 - # 34 - # For example, the hook can simply run git read-tree -u -m HEAD "$1" 35 - # in order to emulate git fetch that is run in the reverse direction 36 - # with git push, as the two-tree form of git read-tree -u -m is 37 - # essentially the same as git switch or git checkout that switches 38 - # branches while keeping the local changes in the working tree that do 39 - # not interfere with the difference between the branches. 40 - 41 - # The below is a more-or-less exact translation to shell of the C code 42 - # for the default behaviour for git's push-to-checkout hook defined in 43 - # the push_to_deploy() function in builtin/receive-pack.c. 44 - # 45 - # Note that the hook will be executed from the repository directory, 46 - # not from the working tree, so if you want to perform operations on 47 - # the working tree, you will have to adapt your code accordingly, e.g. 48 - # by adding "cd .." or using relative paths. 49 - 50 - if ! git update-index -q --ignore-submodules --refresh 51 - then 52 - die "Up-to-date check failed" 53 - fi 54 - 55 - if ! git diff-files --quiet --ignore-submodules -- 56 - then 57 - die "Working directory has unstaged changes" 58 - fi 59 - 60 - # This is a rough translation of: 61 - # 62 - # head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX 63 - if git cat-file -e HEAD 2>/dev/null 64 - then 65 - head=HEAD 66 - else 67 - head=$(git hash-object -t tree --stdin </dev/null) 68 - fi 69 - 70 - if ! git diff-index --quiet --cached --ignore-submodules $head -- 71 - then 72 - die "Working directory has staged changes" 73 - fi 74 - 75 - if ! git read-tree -u -m "$commit" 76 - then 77 - die "Could not update working tree to new HEAD" 78 - fi
-77
forks/eio-process/.git_/hooks/sendemail-validate.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - 3 - # An example hook script to validate a patch (and/or patch series) before 4 - # sending it via email. 5 - # 6 - # The hook should exit with non-zero status after issuing an appropriate 7 - # message if it wants to prevent the email(s) from being sent. 8 - # 9 - # To enable this hook, rename this file to "sendemail-validate". 10 - # 11 - # By default, it will only check that the patch(es) can be applied on top of 12 - # the default upstream branch without conflicts in a secondary worktree. After 13 - # validation (successful or not) of the last patch of a series, the worktree 14 - # will be deleted. 15 - # 16 - # The following config variables can be set to change the default remote and 17 - # remote ref that are used to apply the patches against: 18 - # 19 - # sendemail.validateRemote (default: origin) 20 - # sendemail.validateRemoteRef (default: HEAD) 21 - # 22 - # Replace the TODO placeholders with appropriate checks according to your 23 - # needs. 24 - 25 - validate_cover_letter () { 26 - file="$1" 27 - # TODO: Replace with appropriate checks (e.g. spell checking). 28 - true 29 - } 30 - 31 - validate_patch () { 32 - file="$1" 33 - # Ensure that the patch applies without conflicts. 34 - git am -3 "$file" || return 35 - # TODO: Replace with appropriate checks for this patch 36 - # (e.g. checkpatch.pl). 37 - true 38 - } 39 - 40 - validate_series () { 41 - # TODO: Replace with appropriate checks for the whole series 42 - # (e.g. quick build, coding style checks, etc.). 43 - true 44 - } 45 - 46 - # main ------------------------------------------------------------------------- 47 - 48 - if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1 49 - then 50 - remote=$(git config --default origin --get sendemail.validateRemote) && 51 - ref=$(git config --default HEAD --get sendemail.validateRemoteRef) && 52 - worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) && 53 - git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" && 54 - git config --replace-all sendemail.validateWorktree "$worktree" 55 - else 56 - worktree=$(git config --get sendemail.validateWorktree) 57 - fi || { 58 - echo "sendemail-validate: error: failed to prepare worktree" >&2 59 - exit 1 60 - } 61 - 62 - unset GIT_DIR GIT_WORK_TREE 63 - cd "$worktree" && 64 - 65 - if grep -q "^diff --git " "$1" 66 - then 67 - validate_patch "$1" 68 - else 69 - validate_cover_letter "$1" 70 - fi && 71 - 72 - if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL" 73 - then 74 - git config --unset-all sendemail.validateWorktree && 75 - trap 'git worktree remove -ff "$worktree"' EXIT && 76 - validate_series 77 - fi
-128
forks/eio-process/.git_/hooks/update.sample
··· 1 - #!/nix/store/m0s1xf30bdk6vfn5m6c3mhb2z8w1cib5-bash-5.2-p15/bin/bash 2 - # 3 - # An example hook script to block unannotated tags from entering. 4 - # Called by "git receive-pack" with arguments: refname sha1-old sha1-new 5 - # 6 - # To enable this hook, rename this file to "update". 7 - # 8 - # Config 9 - # ------ 10 - # hooks.allowunannotated 11 - # This boolean sets whether unannotated tags will be allowed into the 12 - # repository. By default they won't be. 13 - # hooks.allowdeletetag 14 - # This boolean sets whether deleting tags will be allowed in the 15 - # repository. By default they won't be. 16 - # hooks.allowmodifytag 17 - # This boolean sets whether a tag may be modified after creation. By default 18 - # it won't be. 19 - # hooks.allowdeletebranch 20 - # This boolean sets whether deleting branches will be allowed in the 21 - # repository. By default they won't be. 22 - # hooks.denycreatebranch 23 - # This boolean sets whether remotely creating branches will be denied 24 - # in the repository. By default this is allowed. 25 - # 26 - 27 - # --- Command line 28 - refname="$1" 29 - oldrev="$2" 30 - newrev="$3" 31 - 32 - # --- Safety check 33 - if [ -z "$GIT_DIR" ]; then 34 - echo "Don't run this script from the command line." >&2 35 - echo " (if you want, you could supply GIT_DIR then run" >&2 36 - echo " $0 <ref> <oldrev> <newrev>)" >&2 37 - exit 1 38 - fi 39 - 40 - if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then 41 - echo "usage: $0 <ref> <oldrev> <newrev>" >&2 42 - exit 1 43 - fi 44 - 45 - # --- Config 46 - allowunannotated=$(git config --type=bool hooks.allowunannotated) 47 - allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) 48 - denycreatebranch=$(git config --type=bool hooks.denycreatebranch) 49 - allowdeletetag=$(git config --type=bool hooks.allowdeletetag) 50 - allowmodifytag=$(git config --type=bool hooks.allowmodifytag) 51 - 52 - # check for no description 53 - projectdesc=$(sed -e '1q' "$GIT_DIR/description") 54 - case "$projectdesc" in 55 - "Unnamed repository"* | "") 56 - echo "*** Project description file hasn't been set" >&2 57 - exit 1 58 - ;; 59 - esac 60 - 61 - # --- Check types 62 - # if $newrev is 0000...0000, it's a commit to delete a ref. 63 - zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') 64 - if [ "$newrev" = "$zero" ]; then 65 - newrev_type=delete 66 - else 67 - newrev_type=$(git cat-file -t $newrev) 68 - fi 69 - 70 - case "$refname","$newrev_type" in 71 - refs/tags/*,commit) 72 - # un-annotated tag 73 - short_refname=${refname##refs/tags/} 74 - if [ "$allowunannotated" != "true" ]; then 75 - echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 76 - echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 77 - exit 1 78 - fi 79 - ;; 80 - refs/tags/*,delete) 81 - # delete tag 82 - if [ "$allowdeletetag" != "true" ]; then 83 - echo "*** Deleting a tag is not allowed in this repository" >&2 84 - exit 1 85 - fi 86 - ;; 87 - refs/tags/*,tag) 88 - # annotated tag 89 - if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 90 - then 91 - echo "*** Tag '$refname' already exists." >&2 92 - echo "*** Modifying a tag is not allowed in this repository." >&2 93 - exit 1 94 - fi 95 - ;; 96 - refs/heads/*,commit) 97 - # branch 98 - if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then 99 - echo "*** Creating a branch is not allowed in this repository" >&2 100 - exit 1 101 - fi 102 - ;; 103 - refs/heads/*,delete) 104 - # delete branch 105 - if [ "$allowdeletebranch" != "true" ]; then 106 - echo "*** Deleting a branch is not allowed in this repository" >&2 107 - exit 1 108 - fi 109 - ;; 110 - refs/remotes/*,commit) 111 - # tracking branch 112 - ;; 113 - refs/remotes/*,delete) 114 - # delete tracking branch 115 - if [ "$allowdeletebranch" != "true" ]; then 116 - echo "*** Deleting a tracking branch is not allowed in this repository" >&2 117 - exit 1 118 - fi 119 - ;; 120 - *) 121 - # Anything else (is there anything else?) 122 - echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 123 - exit 1 124 - ;; 125 - esac 126 - 127 - # --- Finished 128 - exit 0
forks/eio-process/.git_/index

This is a binary file and will not be displayed.

-6
forks/eio-process/.git_/info/exclude
··· 1 - # git ls-files --others --exclude-from=.git/info/exclude 2 - # Lines that start with '#' are comments. 3 - # For a project mostly in C, the following would be a good set of 4 - # exclude patterns (uncomment them if you want to use them): 5 - # *.[oa] 6 - # *~
-1
forks/eio-process/.git_/logs/HEAD
··· 1 - 0000000000000000000000000000000000000000 482ba341884dc8711f93ec9cc6d7c941099e0faa faldor20 <eli.jambu@gmail.com> 1715177866 +1000 clone: from github.com:mbarbin/eio-process.git
-1
forks/eio-process/.git_/logs/refs/heads/main
··· 1 - 0000000000000000000000000000000000000000 482ba341884dc8711f93ec9cc6d7c941099e0faa faldor20 <eli.jambu@gmail.com> 1715177866 +1000 clone: from github.com:mbarbin/eio-process.git
-1
forks/eio-process/.git_/logs/refs/remotes/origin/HEAD
··· 1 - 0000000000000000000000000000000000000000 482ba341884dc8711f93ec9cc6d7c941099e0faa faldor20 <eli.jambu@gmail.com> 1715177866 +1000 clone: from github.com:mbarbin/eio-process.git
forks/eio-process/.git_/objects/pack/pack-40529e2a2816157ff8ee26ff8d9016d33aba5925.idx

This is a binary file and will not be displayed.

forks/eio-process/.git_/objects/pack/pack-40529e2a2816157ff8ee26ff8d9016d33aba5925.pack

This is a binary file and will not be displayed.

forks/eio-process/.git_/objects/pack/pack-40529e2a2816157ff8ee26ff8d9016d33aba5925.rev

This is a binary file and will not be displayed.

-7
forks/eio-process/.git_/packed-refs
··· 1 - # pack-refs with: peeled fully-peeled sorted 2 - 895030dfb8676c5662c6a965743fac47f90b5518 refs/remotes/origin/gh-pages 3 - 482ba341884dc8711f93ec9cc6d7c941099e0faa refs/remotes/origin/main 4 - 5ef670ce4f8e5aadce8bfbb08f63d172fe8f310f refs/tags/0.0.1 5 - ^baf838c5521c7251e6c02871260040e45ca6a42e 6 - 4e06155c6116cb74de5859dad29f76a574245cf5 refs/tags/0.0.2 7 - ^8e19e6b216fff5329f2e34c40a185f577d789c3f
-1
forks/eio-process/.git_/refs/heads/main
··· 1 - 482ba341884dc8711f93ec9cc6d7c941099e0faa
-1
forks/eio-process/.git_/refs/remotes/origin/HEAD
··· 1 - ref: refs/remotes/origin/main
-6
forks/eio-process/.gitattributes
··· 1 - # Tell github that .ml and .mli files are OCaml 2 - *.ml linguist-language=OCaml 3 - *.mli linguist-language=OCaml 4 - 5 - # Disable syntax detection for cram tests 6 - *.t linguist-language=Text
-64
forks/eio-process/.github/workflows/ci.yml
··· 1 - name: ci 2 - 3 - on: 4 - - pull_request 5 - - push 6 - 7 - jobs: 8 - build: 9 - strategy: 10 - fail-fast: false 11 - matrix: 12 - os: 13 - - ubuntu-latest 14 - ocaml-compiler: 15 - - 5.1.x 16 - 17 - runs-on: ${{ matrix.os }} 18 - 19 - steps: 20 - - name: Checkout code 21 - uses: actions/checkout@v4 22 - 23 - - name: Setup OCaml 24 - uses: ocaml/setup-ocaml@v2 25 - with: 26 - ocaml-compiler: ${{ matrix.ocaml-compiler }} 27 - opam-repositories: | 28 - default: https://github.com/ocaml/opam-repository.git 29 - mbarbin: https://github.com/mbarbin/opam-repository.git 30 - # janestreet-bleeding: https://ocaml.janestreet.com/opam-repository 31 - # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages 32 - 33 - - name: Install dependencies 34 - run: opam install . --deps-only --with-doc --with-test 35 - 36 - - name: Build 37 - run: opam exec -- dune build @all @lint 38 - 39 - - name: Run tests 40 - run: | 41 - mkdir $BISECT_DIR 42 - opam exec -- dune runtest --instrument-with bisect_ppx 43 - env: 44 - BISECT_DIR: ${{ runner.temp }}/_bisect_ppx_data 45 - BISECT_FILE: ${{ runner.temp }}/_bisect_ppx_data/data 46 - 47 - - name: Send coverage report to Coveralls 48 - run: opam exec -- bisect-ppx-report send-to Coveralls --coverage-path $BISECT_DIR 49 - env: 50 - BISECT_DIR: ${{ runner.temp }}/_bisect_ppx_data 51 - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} 52 - PULL_REQUEST_NUMBER: ${{ github.event.number }} 53 - 54 - - name: Check for uncommitted changes 55 - run: git diff --exit-code 56 - 57 - - name: Lint opam 58 - uses: ocaml/setup-ocaml/lint-opam@v2 59 - 60 - - name: Lint fmt 61 - uses: ocaml/setup-ocaml/lint-fmt@v2 62 - 63 - - name: Lint doc 64 - uses: ocaml/setup-ocaml/lint-doc@v2
-4
forks/eio-process/.gitignore
··· 1 - _opam 2 - _build 3 - _coverage 4 - *.install
-2
forks/eio-process/.ocamlformat
··· 1 - version=0.26.2 2 - profile=janestreet
-7
forks/eio-process/.vscode/settings.json
··· 1 - { 2 - "cSpell.words": [ 3 - "janestreet", 4 - "odoc", 5 - "opam" 6 - ] 7 - }
-17
forks/eio-process/CHANGES.md
··· 1 - ## 0.0.2 (2024-03-13) 2 - 3 - ### Changed 4 - 5 - - Upgrade `eio` to `1.0` (no change required). 6 - - Uses `expect-test-helpers` (reduce core dependencies) 7 - - Upgrade `eio` to `0.15`. 8 - - Run `ppx_js_style` as a linter & make it a `dev` dependency. 9 - - Upgrade GitHub workflows `actions/checkout` to v4. 10 - - In CI, specify build target `@all`, and add `@lint`. 11 - - List ppxs instead of `ppx_jane`. 12 - 13 - ## 0.0.1 (2024-02-25) 14 - 15 - ### Added 16 - 17 - - Add an initial API.
-22
forks/eio-process/LICENSE
··· 1 - MIT License 2 - 3 - 4 - Copyright (c) 2023 Mathieu Barbin 5 - 6 - Permission is hereby granted, free of charge, to any person obtaining a copy 7 - of this software and associated documentation files (the "Software"), to deal 8 - in the Software without restriction, including without limitation the rights 9 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 - copies of the Software, and to permit persons to whom the Software is 11 - furnished to do so, subject to the following conditions: 12 - 13 - The above copyright notice and this permission notice shall be included in all 14 - copies or substantial portions of the Software. 15 - 16 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 - SOFTWARE.
-18
forks/eio-process/LICENSE.eio
··· 1 - This project extends the module `Eio.Process` from the 2 - [eio](https://github.com/ocaml-multicore/eio) project, which has the 3 - following license: 4 - 5 - Copyright (C) 2021 Anil Madhavapeddy 6 - Copyright (C) 2022 Thomas Leonard 7 - 8 - Permission to use, copy, modify, and distribute this software for any 9 - purpose with or without fee is hereby granted, provided that the above 10 - copyright notice and this permission notice appear in all copies. 11 - 12 - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-25
forks/eio-process/LICENSE.janestreet
··· 1 - This project took inspiration from the `Async_unix.Process` module, 2 - from the [async_unix](https://github.com/janestreet/async_unix) 3 - project, which has the following license: 4 - 5 - The MIT License 6 - 7 - Copyright (c) 2008--2023 Jane Street Group, LLC <opensource-contacts@janestreet.com> 8 - 9 - Permission is hereby granted, free of charge, to any person obtaining a copy 10 - of this software and associated documentation files (the "Software"), to deal 11 - in the Software without restriction, including without limitation the rights 12 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 - copies of the Software, and to permit persons to whom the Software is 14 - furnished to do so, subject to the following conditions: 15 - 16 - The above copyright notice and this permission notice shall be included in all 17 - copies or substantial portions of the Software. 18 - 19 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 - SOFTWARE.
-34
forks/eio-process/Makefile
··· 1 - .PHONY: all 2 - all: build 3 - 4 - .PHONY: build 5 - build: 6 - opam exec -- dune build 7 - 8 - .PHONY: test 9 - test: 10 - opam exec -- dune runtest 11 - 12 - .PHONY: fmt 13 - fmt: 14 - opam exec -- dune build @fmt --auto-promote 15 - 16 - .PHONY: lint 17 - lint: 18 - opam lint 19 - opam exec -- opam-dune-lint 20 - 21 - .PHONY: deps 22 - deps: 23 - opam install . --deps-only --with-doc --with-test 24 - 25 - .PHONY: doc 26 - doc: 27 - opam exec -- dune build @doc 28 - 29 - .PHONY: clean 30 - clean: 31 - opam exec -- dune clean 32 - 33 - .PHONY: check-all 34 - check-all: deps all test doc clean lint fmt
-43
forks/eio-process/README.md
··· 1 - # eio-process 2 - 3 - [![CI Status](https://github.com/mbarbin/eio-process/workflows/ci/badge.svg)](https://github.com/mbarbin/eio-process/actions/workflows/ci.yml) 4 - [![Coverage Status](https://coveralls.io/repos/github/mbarbin/eio-process/badge.svg?branch=main)](https://coveralls.io/github/mbarbin/eio-process?branch=main) 5 - 6 - This is an experimental library to spawn external processes in 7 - [Eio](https://github.com/ocaml-multicore/eio) with an api that resembles 8 - [Async.Process](https://github.com/janestreet/async_unix). 9 - 10 - This project re-uses some function and type names from the `Async_unix.Process` 11 - interface. The implementation however is quite different, since the original 12 - runs in the `Async` monad, whereas this lib targets `Eio`. 13 - 14 - ## Motivation 15 - 16 - We find that this API offers convenient wrappers that we believe are a good fit 17 - on top of the core functionality offered by `Eio.Process`. 18 - 19 - ## Usage 20 - 21 - `Eio_process` is meant to be used directly as a top-level module, alongside 22 - other `Eio` modules. We do not recommend shadowing `Eio.Process` with 23 - `Eio_process` in user code at this time. 24 - 25 - ## Acknowledgements 26 - 27 - We would like to express our gratitude to the `Eio` developers for their work on 28 - the [eio](https://github.com/ocaml-multicore/eio) project, and for the original 29 - module `Eio.Process` that this project extends. `Eio` is released under the 30 - terms of an ISC License. Its copyright and permission notice are included at the 31 - root of this project, in the file `LICENSE.eio`. 32 - 33 - We also appreciate the work done by the async team at Jane Street and their 34 - contribution to the open source community. We're thankful for the api exposed by 35 - the `Async_unix.Process` module which we took inspiration from in this project. 36 - `Async_unix` is released under the terms of an `MIT` License. Its copyright and 37 - permission notice are included at the root of this project, in the file 38 - `LICENSE.janestreet`. 39 - 40 - ## Code documentation 41 - 42 - The code documentation of the latest release is built with `odoc` and published 43 - to `GitHub` pages [here](https://mbarbin.github.io/eio-process).
-4
forks/eio-process/dune
··· 1 - (env 2 - (dev 3 - (odoc 4 - (warnings fatal))))
-85
forks/eio-process/dune-project
··· 1 - (lang dune 3.12) 2 - 3 - (name eio-process) 4 - 5 - (generate_opam_files) 6 - 7 - (license MIT) 8 - 9 - (authors "Mathieu Barbin") 10 - 11 - (maintainers "Mathieu Barbin") 12 - 13 - (source 14 - (github mbarbin/eio-process)) 15 - 16 - (documentation "https://mbarbin.github.io/eio-process/") 17 - 18 - (package 19 - (name eio-process) 20 - (synopsis 21 - "Run external processes in [Eio] with an api that resembles [Async_unix.Process]") 22 - (depends 23 - (ocaml 24 - (>= 5.1)) 25 - (base 26 - (and 27 - (>= v0.16) 28 - (< v0.17))) 29 - (bisect_ppx 30 - (and 31 - :dev 32 - (>= 2.8.3))) 33 - (eio 34 - (>= 1.0)) 35 - (eio_main 36 - (and 37 - :with-test 38 - (>= 1.0))) 39 - (expect-test-helpers 40 - (and 41 - :with-test 42 - (>= v0.16) 43 - (< v0.17))) 44 - (parsexp 45 - (and 46 - (>= v0.16) 47 - (< v0.17))) 48 - (ppx_compare 49 - (and 50 - (>= v0.16) 51 - (< v0.17))) 52 - (ppx_enumerate 53 - (and 54 - (>= v0.16) 55 - (< v0.17))) 56 - (ppx_expect 57 - (and 58 - :with-test 59 - (>= v0.16) 60 - (< v0.17))) 61 - (ppx_hash 62 - (and 63 - (>= v0.16) 64 - (< v0.17))) 65 - (ppx_here 66 - (and 67 - (>= v0.16) 68 - (< v0.17))) 69 - (ppx_js_style 70 - (and 71 - :dev 72 - (>= v0.16) 73 - (< v0.17))) 74 - (ppx_let 75 - (and 76 - (>= v0.16) 77 - (< v0.17))) 78 - (ppx_sexp_conv 79 - (and 80 - (>= v0.16) 81 - (< v0.17))) 82 - (ppx_sexp_value 83 - (and 84 - (>= v0.16) 85 - (< v0.17)))))
-45
forks/eio-process/eio-process.opam
··· 1 - # This file is generated by dune, edit dune-project instead 2 - opam-version: "2.0" 3 - synopsis: 4 - "Run external processes in [Eio] with an api that resembles [Async_unix.Process]" 5 - maintainer: ["Mathieu Barbin"] 6 - authors: ["Mathieu Barbin"] 7 - license: "MIT" 8 - homepage: "https://github.com/mbarbin/eio-process" 9 - doc: "https://mbarbin.github.io/eio-process/" 10 - bug-reports: "https://github.com/mbarbin/eio-process/issues" 11 - depends: [ 12 - "dune" {>= "3.12"} 13 - "ocaml" {>= "5.1"} 14 - "base" {>= "v0.16" & < "v0.17"} 15 - "bisect_ppx" {dev & >= "2.8.3"} 16 - "eio" {>= "1.0"} 17 - "eio_main" {with-test & >= "1.0"} 18 - "expect-test-helpers" {with-test & >= "v0.16" & < "v0.17"} 19 - "parsexp" {>= "v0.16" & < "v0.17"} 20 - "ppx_compare" {>= "v0.16" & < "v0.17"} 21 - "ppx_enumerate" {>= "v0.16" & < "v0.17"} 22 - "ppx_expect" {with-test & >= "v0.16" & < "v0.17"} 23 - "ppx_hash" {>= "v0.16" & < "v0.17"} 24 - "ppx_here" {>= "v0.16" & < "v0.17"} 25 - "ppx_js_style" {dev & >= "v0.16" & < "v0.17"} 26 - "ppx_let" {>= "v0.16" & < "v0.17"} 27 - "ppx_sexp_conv" {>= "v0.16" & < "v0.17"} 28 - "ppx_sexp_value" {>= "v0.16" & < "v0.17"} 29 - "odoc" {with-doc} 30 - ] 31 - build: [ 32 - ["dune" "subst"] {dev} 33 - [ 34 - "dune" 35 - "build" 36 - "-p" 37 - name 38 - "-j" 39 - jobs 40 - "@install" 41 - "@runtest" {with-test} 42 - "@doc" {with-doc} 43 - ] 44 - ] 45 - dev-repo: "git+https://github.com/mbarbin/eio-process.git"
-27
forks/eio-process/src/dune
··· 1 - (library 2 - (name eio_process) 3 - (public_name eio-process) 4 - (flags 5 - :standard 6 - -w 7 - +a-4-40-41-42-44-45-48-66 8 - -warn-error 9 - +a 10 - -open 11 - Base 12 - -open 13 - Or_error.Let_syntax) 14 - (libraries base eio parsexp) 15 - (instrumentation 16 - (backend bisect_ppx)) 17 - (lint 18 - (pps ppx_js_style -check-doc-comments)) 19 - (preprocess 20 - (pps 21 - ppx_compare 22 - ppx_enumerate 23 - ppx_hash 24 - ppx_here 25 - ppx_let 26 - ppx_sexp_conv 27 - ppx_sexp_value)))
-147
forks/eio-process/src/eio_process.ml
··· 1 - module Exit_status = struct 2 - [@@@coverage off] 3 - 4 - type t = 5 - [ `Exited of int 6 - | `Signaled of int 7 - ] 8 - [@@deriving sexp_of] 9 - end 10 - 11 - module Lines_or_sexp = struct 12 - type t = 13 - | Lines of string list 14 - | Sexp of Sexp.t 15 - 16 - let sexp_of_t t = 17 - match t with 18 - | Lines [] -> [%sexp ""] 19 - | Lines lines -> [%sexp (lines : string list)] 20 - | Sexp sexp -> sexp 21 - ;; 22 - 23 - let create string = 24 - try Sexp (Parsexp.Conv_single.parse_string_exn string Fn.id) with 25 - | _ -> Lines (String.split_lines string) 26 - ;; 27 - end 28 - 29 - module Output = struct 30 - type t = 31 - { stdout : string 32 - ; stderr : string 33 - ; exit_status : Exit_status.t 34 - } 35 - 36 - let sexp_of_t { stdout; stderr; exit_status } = 37 - [%sexp 38 - { stdout = (Lines_or_sexp.create stdout : Lines_or_sexp.t) 39 - ; stderr = (Lines_or_sexp.create stderr : Lines_or_sexp.t) 40 - ; exit_status : Exit_status.t 41 - }] 42 - ;; 43 - 44 - let exited t ~accept_exit_codes = 45 - match 46 - match t.exit_status with 47 - | `Exited code -> List.Assoc.find accept_exit_codes ~equal:Int.equal code 48 - | `Signaled _ -> None 49 - with 50 - | Some a -> Ok a 51 - | None -> 52 - Or_error.error_s 53 - [%sexp 54 - "unexpected exit status" 55 - , { accept_exit_codes = (List.map accept_exit_codes ~f:fst : int list) }] 56 - ;; 57 - 58 - let exit ?(accept_nonzero_exit = []) t = 59 - exited 60 - t 61 - ~accept_exit_codes: 62 - ((0, ()) :: List.map accept_nonzero_exit ~f:(fun code -> code, ())) 63 - ;; 64 - 65 - let exit_and_stdout ?accept_nonzero_exit t = 66 - let%map () = exit t ?accept_nonzero_exit in 67 - t.stdout 68 - ;; 69 - 70 - let expect_no_output ?(accept_nonzero_exit = []) t = 71 - let%bind stdout = exit_and_stdout t ~accept_nonzero_exit in 72 - if String.is_empty stdout then Ok () else Or_error.error_string "expected no output" 73 - ;; 74 - end 75 - 76 - exception User_error of Error.t 77 - 78 - let run ~process_mgr ~cwd ?stdin ?env ~prog ~args () ~f = 79 - Eio.Switch.run 80 - @@ fun sw -> 81 - let r, w = Eio.Process.pipe process_mgr ~sw in 82 - let re, we = Eio.Process.pipe process_mgr ~sw in 83 - let exit_status_r : [ Exit_status.t | `Unknown ] ref = ref `Unknown in 84 - let stdout_r = ref "" in 85 - let stderr_r = ref "" in 86 - try 87 - let child = 88 - Eio.Process.spawn 89 - ~sw 90 - process_mgr 91 - ~cwd 92 - ?stdin 93 - ~stdout:w 94 - ~stderr:we 95 - ?env 96 - ?executable:None 97 - (prog :: args) 98 - in 99 - Eio.Flow.close w; 100 - Eio.Flow.close we; 101 - let stdout = Eio.Buf_read.parse_exn Eio.Buf_read.take_all r ~max_size:Int.max_value in 102 - stdout_r := stdout; 103 - let stderr = 104 - Eio.Buf_read.parse_exn Eio.Buf_read.take_all re ~max_size:Int.max_value 105 - in 106 - stderr_r := stderr; 107 - Eio.Flow.close r; 108 - let exit_status = Eio.Process.await child in 109 - exit_status_r := (exit_status :> [ Exit_status.t | `Unknown ]); 110 - match f { Output.stdout; stderr; exit_status } with 111 - | Ok _ as ok -> ok 112 - | Error err -> raise (User_error err) 113 - with 114 - | (Eio.Exn.Io _ | User_error _) as exn -> 115 - let error = 116 - match exn with 117 - | Eio.Exn.Io _ -> Error.of_exn exn 118 - | User_error error -> error 119 - | _ -> assert false 120 - in 121 - Or_error.error_s 122 - [%sexp 123 - { prog : string 124 - ; args : string list 125 - ; exit_status = (!exit_status_r : [ Exit_status.t | `Unknown ]) 126 - ; cwd = (snd cwd : string) 127 - ; stdout = (Lines_or_sexp.create !stdout_r : Lines_or_sexp.t) 128 - ; stderr = (Lines_or_sexp.create !stderr_r : Lines_or_sexp.t) 129 - ; error : Error.t 130 - }] 131 - ;; 132 - 133 - let run_stdout ~process_mgr ~cwd ?stdin ?accept_nonzero_exit ?env ~prog ~args () = 134 - run ~process_mgr ~cwd ?stdin ?env ~prog ~args () ~f:(fun output -> 135 - Output.exit_and_stdout output ?accept_nonzero_exit) 136 - ;; 137 - 138 - let run_lines ~process_mgr ~cwd ?stdin ?accept_nonzero_exit ?env ~prog ~args () = 139 - run ~process_mgr ~cwd ?stdin ?env ~prog ~args () ~f:(fun output -> 140 - Output.exit_and_stdout output ?accept_nonzero_exit >>| String.split_lines) 141 - ;; 142 - 143 - let run_expect_no_output ~process_mgr ~cwd ?stdin ?accept_nonzero_exit ?env ~prog ~args () 144 - = 145 - run ~process_mgr ~cwd ?stdin ?env ~prog ~args () ~f:(fun output -> 146 - Output.expect_no_output output ?accept_nonzero_exit) 147 - ;;
-68
forks/eio-process/src/eio_process.mli
··· 1 - (** Spawn external processes in [Eio] with convenient wrappers inspired by 2 - [Async_unix.Process]. *) 3 - 4 - module Exit_status : sig 5 - type t = 6 - [ `Exited of int 7 - | `Signaled of int 8 - ] 9 - [@@deriving sexp_of] 10 - end 11 - 12 - module Output : sig 13 - type t = 14 - { stdout : string 15 - ; stderr : string 16 - ; exit_status : Exit_status.t 17 - } 18 - [@@deriving sexp_of] 19 - 20 - val exit : ?accept_nonzero_exit:int list -> t -> unit Or_error.t 21 - val exit_and_stdout : ?accept_nonzero_exit:int list -> t -> string Or_error.t 22 - val exited : t -> accept_exit_codes:(int * 'a) list -> 'a Or_error.t 23 - val expect_no_output : ?accept_nonzero_exit:int list -> t -> unit Or_error.t 24 - end 25 - 26 - val run 27 - : process_mgr:_ Eio.Process.mgr 28 - -> cwd:Eio.Fs.dir_ty Eio.Path.t 29 - -> ?stdin:_ Eio.Flow.source 30 - -> ?env:string array 31 - -> prog:string 32 - -> args:string list 33 - -> unit 34 - -> f:(Output.t -> 'a Or_error.t) 35 - -> 'a Or_error.t 36 - 37 - val run_stdout 38 - : process_mgr:_ Eio.Process.mgr 39 - -> cwd:Eio.Fs.dir_ty Eio.Path.t 40 - -> ?stdin:_ Eio.Flow.source 41 - -> ?accept_nonzero_exit:int list 42 - -> ?env:string array 43 - -> prog:string 44 - -> args:string list 45 - -> unit 46 - -> string Or_error.t 47 - 48 - val run_lines 49 - : process_mgr:_ Eio.Process.mgr 50 - -> cwd:Eio.Fs.dir_ty Eio.Path.t 51 - -> ?stdin:_ Eio.Flow.source 52 - -> ?accept_nonzero_exit:int list 53 - -> ?env:string array 54 - -> prog:string 55 - -> args:string list 56 - -> unit 57 - -> string list Or_error.t 58 - 59 - val run_expect_no_output 60 - : process_mgr:_ Eio.Process.mgr 61 - -> cwd:Eio.Fs.dir_ty Eio.Path.t 62 - -> ?stdin:_ Eio.Flow.source 63 - -> ?accept_nonzero_exit:int list 64 - -> ?env:string array 65 - -> prog:string 66 - -> args:string list 67 - -> unit 68 - -> unit Or_error.t
-8
forks/eio-process/test/bin/dune
··· 1 - (executable 2 - (name main) 3 - (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a -open Base) 4 - (libraries base unix) 5 - (instrumentation 6 - (backend bisect_ppx)) 7 - (preprocess 8 - (pps ppx_sexp_value ppx_js_style -check-doc-comments)))
-42
forks/eio-process/test/bin/main.ml
··· 1 - let exit_code = ref 0 2 - let stdout = ref false 3 - let stderr = ref false 4 - let output_sexp = ref false 5 - let signal = ref false 6 - 7 - let spec_list = 8 - [ "--exit-code", Stdlib.Arg.Set_int exit_code, " Exit with given code" 9 - ; "--stdout", Stdlib.Arg.Set stdout, " Write to stdout" 10 - ; "--stderr", Stdlib.Arg.Set stderr, " Write to stderr" 11 - ; "--output-sexp", Stdlib.Arg.Set output_sexp, " Make output format a s-expression" 12 - ; "--signal", Stdlib.Arg.Set signal, " Send a kill signal to itself" 13 - ] 14 - ;; 15 - 16 - let lorem_ipsum = 17 - lazy 18 - ({| 19 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas quis nisi id 20 - lorem scelerisque bibendum eget id felis. Pellentesque consectetur tincidunt 21 - ornare. 22 - |} 23 - |> String.strip) 24 - ;; 25 - 26 - let sexp = lazy [%sexp { words = [ "Lorem"; "ipsum"; "dolor"; "sit"; "amet" ] }] 27 - 28 - let () = 29 - Stdlib.Arg.parse spec_list ignore "test"; 30 - if !stdout 31 - then 32 - if !output_sexp 33 - then Stdlib.print_endline (force sexp |> Sexp.to_string_hum) 34 - else Stdlib.print_endline (force lorem_ipsum); 35 - if !stderr 36 - then 37 - if !output_sexp 38 - then Stdlib.prerr_endline "()" 39 - else Stdlib.prerr_endline (force lorem_ipsum); 40 - if !signal then Unix.kill (Unix.getpid ()) Stdlib.Sys.sigkill [@coverage off]; 41 - Stdlib.exit !exit_code [@coverage off] 42 - ;;
-31
forks/eio-process/test/dune
··· 1 - (library 2 - (name eio_process_test) 3 - (flags 4 - :standard 5 - -w 6 - +a-4-40-41-42-44-45-48-66 7 - -warn-error 8 - +a 9 - -open 10 - Base 11 - -open 12 - Expect_test_helpers 13 - -open 14 - Or_error.Let_syntax) 15 - (libraries base eio_main eio_process expect-test-helpers) 16 - (inline_tests 17 - (deps ./bin/main.exe)) 18 - (instrumentation 19 - (backend bisect_ppx)) 20 - (lint 21 - (pps ppx_js_style -check-doc-comments)) 22 - (preprocess 23 - (pps 24 - ppx_compare 25 - ppx_enumerate 26 - ppx_expect 27 - ppx_hash 28 - ppx_here 29 - ppx_let 30 - ppx_sexp_conv 31 - ppx_sexp_value)))
-213
forks/eio-process/test/test__eio_process.ml
··· 1 - let%expect_test "run" = 2 - (* Returning the [Output.t]. *) 3 - Eio_main.run 4 - @@ fun env -> 5 - let result = 6 - Eio_process.run 7 - ~process_mgr:(Eio.Stdenv.process_mgr env) 8 - ~cwd:(Eio.Stdenv.cwd env) 9 - ~stdin:(Eio.Flow.string_source "Hello World!") 10 - ~prog:"cat" 11 - ~args:[] 12 - () 13 - ~f:Or_error.return 14 - in 15 - print_s [%sexp (result : Eio_process.Output.t Or_error.t)]; 16 - [%expect {| (Ok ((stdout ("Hello World!")) (stderr "") (exit_status (Exited 0)))) |}]; 17 - (* Executable not found. *) 18 - let result = 19 - Eio_process.run 20 - ~process_mgr:(Eio.Stdenv.process_mgr env) 21 - ~cwd:(Eio.Stdenv.cwd env) 22 - ~stdin:(Eio.Flow.string_source "Hello World!") 23 - ~prog:"invalid-program-not-found-314" 24 - ~args:[ "foo"; "bar" ] 25 - () 26 - ~f:Or_error.return 27 - in 28 - print_s [%sexp (result : Eio_process.Output.t Or_error.t)]; 29 - [%expect 30 - {| 31 - (Error ( 32 - (prog invalid-program-not-found-314) 33 - (args (foo bar)) 34 - (exit_status Unknown) 35 - (cwd "") 36 - (stdout "") 37 - (stderr "") 38 - (error ( 39 - "Eio.Io Process Executable \"invalid-program-not-found-314\" not found")))) |}]; 40 - (* Accept nonzero exit code. *) 41 - let result = 42 - Eio_process.run_stdout 43 - ~process_mgr:(Eio.Stdenv.process_mgr env) 44 - ~cwd:(Eio.Stdenv.cwd env) 45 - ~prog:"./bin/main.exe" 46 - ~args:[] 47 - () 48 - in 49 - print_s [%sexp (result : string Or_error.t)]; 50 - [%expect {| (Ok "") |}]; 51 - let result = 52 - Eio_process.run_stdout 53 - ~process_mgr:(Eio.Stdenv.process_mgr env) 54 - ~cwd:(Eio.Stdenv.cwd env) 55 - ~prog:"./bin/main.exe" 56 - ~args:[ "--exit-code"; "128" ] 57 - () 58 - in 59 - print_s [%sexp (result : string Or_error.t)]; 60 - [%expect 61 - {| 62 - (Error ( 63 - (prog ./bin/main.exe) 64 - (args (--exit-code 128)) 65 - (exit_status (Exited 128)) 66 - (cwd "") 67 - (stdout "") 68 - (stderr "") 69 - (error ("unexpected exit status" ((accept_exit_codes (0))))))) |}]; 70 - let result = 71 - Eio_process.run_stdout 72 - ~process_mgr:(Eio.Stdenv.process_mgr env) 73 - ~cwd:(Eio.Stdenv.cwd env) 74 - ~accept_nonzero_exit:[ 128 ] 75 - ~prog:"./bin/main.exe" 76 - ~args:[ "--exit-code"; "128" ] 77 - () 78 - in 79 - print_s [%sexp (result : string Or_error.t)]; 80 - [%expect {| (Ok "") |}]; 81 - (* Signal. *) 82 - let result = 83 - Eio_process.run_stdout 84 - ~process_mgr:(Eio.Stdenv.process_mgr env) 85 - ~cwd:(Eio.Stdenv.cwd env) 86 - ~prog:"./bin/main.exe" 87 - ~args:[ "--signal" ] 88 - () 89 - in 90 - print_s [%sexp (result : string Or_error.t)]; 91 - [%expect 92 - {| 93 - (Error ( 94 - (prog ./bin/main.exe) 95 - (args (--signal)) 96 - (exit_status (Signaled -7)) 97 - (cwd "") 98 - (stdout "") 99 - (stderr "") 100 - (error ("unexpected exit status" ((accept_exit_codes (0))))))) |}]; 101 - (* Run lines. *) 102 - let result = 103 - Eio_process.run_lines 104 - ~process_mgr:(Eio.Stdenv.process_mgr env) 105 - ~cwd:(Eio.Stdenv.cwd env) 106 - ~prog:"./bin/main.exe" 107 - ~args:[] 108 - () 109 - in 110 - print_s [%sexp (result : string list Or_error.t)]; 111 - [%expect {| (Ok ()) |}]; 112 - let result = 113 - Eio_process.run_lines 114 - ~process_mgr:(Eio.Stdenv.process_mgr env) 115 - ~cwd:(Eio.Stdenv.cwd env) 116 - ~prog:"./bin/main.exe" 117 - ~args:[ "--stdout" ] 118 - () 119 - in 120 - print_s [%sexp (result : string list Or_error.t)]; 121 - [%expect 122 - {| 123 - (Ok ( 124 - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas quis nisi id" 125 - "lorem scelerisque bibendum eget id felis. Pellentesque consectetur tincidunt" 126 - ornare.)) |}]; 127 - (* Run expect no output. *) 128 - let result = 129 - Eio_process.run_expect_no_output 130 - ~process_mgr:(Eio.Stdenv.process_mgr env) 131 - ~cwd:(Eio.Stdenv.cwd env) 132 - ~prog:"./bin/main.exe" 133 - ~args:[ "--stderr" ] 134 - () 135 - in 136 - print_s [%sexp (result : unit Or_error.t)]; 137 - [%expect {| (Ok ()) |}]; 138 - let result = 139 - Eio_process.run_expect_no_output 140 - ~process_mgr:(Eio.Stdenv.process_mgr env) 141 - ~cwd:(Eio.Stdenv.cwd env) 142 - ~prog:"./bin/main.exe" 143 - ~args:[ "--stdout" ] 144 - () 145 - in 146 - print_s [%sexp (result : unit Or_error.t)]; 147 - [%expect 148 - {| 149 - (Error ( 150 - (prog ./bin/main.exe) 151 - (args (--stdout)) 152 - (exit_status (Exited 0)) 153 - (cwd "") 154 - (stdout ( 155 - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas quis nisi id" 156 - "lorem scelerisque bibendum eget id felis. Pellentesque consectetur tincidunt" 157 - ornare.)) 158 - (stderr "") 159 - (error "expected no output"))) |}]; 160 - (* User further processing the output. *) 161 - let result = 162 - Eio_process.run 163 - ~process_mgr:(Eio.Stdenv.process_mgr env) 164 - ~cwd:(Eio.Stdenv.cwd env) 165 - ~prog:"./bin/main.exe" 166 - ~args:[ "--stdout"; "--stderr"; "--output-sexp"; "--exit-code"; "128" ] 167 - () 168 - ~f:(fun output -> 169 - match%map 170 - Eio_process.Output.exited output ~accept_exit_codes:[ 0, `Zero; 1, `One ] 171 - with 172 - | `Zero | `One -> assert false) 173 - in 174 - (* When the user function [f] returned an Error, we include all the info in 175 - the error message. *) 176 - print_s [%sexp (result : int Or_error.t)]; 177 - [%expect 178 - {| 179 - (Error ( 180 - (prog ./bin/main.exe) 181 - (args (--stdout --stderr --output-sexp --exit-code 128)) 182 - (exit_status (Exited 128)) 183 - (cwd "") 184 - (stdout ((words (Lorem ipsum dolor sit amet)))) 185 - (stderr ()) 186 - (error ("unexpected exit status" ((accept_exit_codes (0 1))))))) |}]; 187 - let result = 188 - Eio_process.run 189 - ~process_mgr:(Eio.Stdenv.process_mgr env) 190 - ~cwd:(Eio.Stdenv.cwd env) 191 - ~prog:"./bin/main.exe" 192 - ~args:[ "--stdout"; "--output-sexp"; "--exit-code"; "1" ] 193 - () 194 - ~f:(fun output -> 195 - match%map 196 - Eio_process.Output.exited output ~accept_exit_codes:[ 0, `Zero; 1, `One ] 197 - with 198 - | `One -> 1 199 - | `Zero -> assert false) 200 - in 201 - print_s [%sexp (result : int Or_error.t)]; 202 - [%expect {| (Ok 1) |}]; 203 - () 204 - ;; 205 - 206 - let%expect_test "lines" = 207 - (* We monitor this as these results influence the implementation [Lines_or_sexp]. *) 208 - print_s [%sexp (String.split ~on:'\n' "" : string list)]; 209 - [%expect {| ("") |}]; 210 - print_s [%sexp (String.split_lines "" : string list)]; 211 - [%expect {| () |}]; 212 - () 213 - ;;
-1
forks/eio-process/test/test__eio_process.mli
··· 1 - (*_ This signature is deliberately empty. *)
+9
jj_tui.opam
··· 20 20 "angstrom" 21 21 "ppx_expect" 22 22 "ppx_jane" 23 + "lwd" 24 + "eio-process" 25 + "notty" 23 26 "odoc" {with-doc} 24 27 ] 25 28 build: [ ··· 39 42 dev-repo: "git+https://github.com/username/reponame.git" 40 43 41 44 x-opam-monorepo-opam-provided: ["lwd"] 45 + 46 + #This is needed because eio-process doesn't exict 47 + pin-depends:[ 48 + ["eio-process.dev" "git+https://github.com/mbarbin/eio-process"] 49 + ] 50 +
+6
jj_tui.opam.template
··· 1 1 2 2 x-opam-monorepo-opam-provided: ["lwd"] 3 + 4 + #This is needed because eio-process doesn't exict 5 + pin-depends:[ 6 + ["eio-process.dev" "git+https://github.com/mbarbin/eio-process"] 7 + ] 8 +
+6 -1
jj_tui/bin/dune
··· 1 1 (executable 2 2 (public_name jj_tui) 3 3 (name main) 4 - (flags(:standard -cclib -static -cclib -no-pie)) 5 4 (libraries jj_tui lwd nottui base stdio eio_main eio-process ) 6 5 ) 6 + 7 + (env 8 + (static 9 + (flags(:standard -cclib -static -cclib -no-pie)) 10 + ) 11 + )
+44 -21
jj_tui/flake.nix
··· 4 4 # Flake inputs 5 5 inputs = { 6 6 7 - # nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 8 7 nixpkgs.url = "github:nixos/nixpkgs"; # also valid: "nixpkgs" 9 8 10 - # roc={ 11 - # url="github:roc-lang/roc"; 12 - # inputs.nixpkgs.follows="nixpkgs"; 13 - 14 - # }; 15 - 16 9 }; 17 10 # Flake outputs 18 11 outputs = { self, nixpkgs, ... }@inputs: 19 12 let 20 13 # Systems supported 21 - allSystems = [ 22 - "x86_64-linux" # 64-bit Intel/AMD Linux 23 - ]; 14 + allSystems = 15 + [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; 24 16 25 17 # Helper to provide system-specific attributes 26 18 forAllSystems = f: 27 19 nixpkgs.lib.genAttrs allSystems (system: 28 20 f { 21 + # OCaml packages available on nixpkgs 29 22 pkgs = import nixpkgs { inherit system; }; 30 - 23 + ocamlPackages = 24 + nixpkgs.legacyPackages.${system}.ocamlPackages; # Legacy packages that have not been converted to flakes 31 25 }); 32 26 in { 27 + packages = forAllSystems ({ pkgs, ocamlPackages }: { 28 + default = ocamlPackages.buildDunePackage { 29 + pname = "hello"; 30 + version = "0.1.0"; 31 + duneVersion = "3"; 32 + src = ./.; 33 + 34 + buildInputs = [ 35 + 36 + # Ocaml package dependencies needed to build go here. 37 + ]; 38 + 39 + strictDeps = true; 40 + 41 + preBuild = '' 42 + opam install . opam-monorepo 43 + opam monorepo pull 44 + ''; 45 + }; 46 + }); 47 + 33 48 # Development environment output 34 49 devShells = forAllSystems ({ pkgs }: { 35 50 default = 36 51 37 52 pkgs.mkShell { 38 - packages = with pkgs; [ pkgs.pkgsStatic.pkg-config pkgs.pkgsStatic.gmp pkgsStatic.stdenv.cc.cc.lib jujutsu musl pkgs.pkgsStatic.dune ]; 39 - shellHook = let 40 - libPath = 41 - pkgs.lib.makeLibraryPath [ pkgs.pkgsStatic.stdenv.cc.cc.lib pkgs.pkgsStatic.gmp pkgs.pkgsStatic.musl ]; 42 - in '' 43 - export CC=${pkgs.pkgsStatic.musl.stdenv.cc} 44 - # yolo 45 - export CFLAGS="$CFLAGS -I${pkgs.pkgsStatic.stdenv.cc.cc.lib}/include -I${pkgs.pkgsStatic.gmp}/include" 46 - export LIBS="$LIBS -L${pkgs.pkgsStatic.stdenv.cc.cc.lib}/lib -L${pkgs.pkgsStatic.gmp}/lib" 47 - ''; 53 + packages = with pkgs; [ 54 + gmp 55 + stdenv.cc.cc.lib 56 + dune_3 57 + clang 58 + ocaml 59 + opam 60 + fish 61 + ]; 62 + # shellHook = let 63 + # libPath = 64 + # pkgs.lib.makeLibraryPath [ pkgs.pkgsStatic.stdenv.cc.cc.lib pkgs.pkgsStatic.gmp pkgs.pkgsStatic.musl ]; 65 + # in '' 66 + # export CC=${pkgs.pkgsStatic.musl.stdenv.cc} 67 + # # yolo 68 + # export CFLAGS="$CFLAGS -I${pkgs.pkgsStatic.stdenv.cc.cc.lib}/include -I${pkgs.pkgsStatic.gmp}/include" 69 + # export LIBS="$LIBS -L${pkgs.pkgsStatic.stdenv.cc.cc.lib}/lib -L${pkgs.pkgsStatic.gmp}/lib" 70 + # ''; 48 71 }; 49 72 50 73 });
+1 -1
jj_tui/test/dune
··· 2 2 (name jj_tui) 3 3 (libraries jj_tui) 4 4 (preprocess 5 - (pps ppx_jane ppx_expect))) 5 + (pps ppx_expect)))