diff --git a/testdata/add.txt b/testdata/add.txt index 4aa86233..da9e0e95 100644 --- a/testdata/add.txt +++ b/testdata/add.txt @@ -1,3 +1,5 @@ +[windows] skip + exec git init exec lefthook add pre-commit ! stderr . diff --git a/testdata/dump.txt b/testdata/dump.txt index 3857f0d4..5a5559e3 100644 --- a/testdata/dump.txt +++ b/testdata/dump.txt @@ -1,3 +1,5 @@ +[windows] skip + exec git init exec lefthook dump cmp stdout lefthook-dumped.yml diff --git a/testdata/remote.txt b/testdata/remote.txt index 72435af1..df0c246b 100644 --- a/testdata/remote.txt +++ b/testdata/remote.txt @@ -1,3 +1,5 @@ +[windows] skip + exec git init exec lefthook install diff --git a/testdata/remotes.txt b/testdata/remotes.txt index 7858b6e3..beffc20f 100644 --- a/testdata/remotes.txt +++ b/testdata/remotes.txt @@ -1,3 +1,5 @@ +[windows] skip + exec git init exec lefthook install diff --git a/testdata/run_interrupt.txt b/testdata/run_interrupt.txt index 9103d014..2716c53d 100644 --- a/testdata/run_interrupt.txt +++ b/testdata/run_interrupt.txt @@ -1,3 +1,5 @@ +[windows] skip + chmod 0700 hook.sh chmod 0700 commit-with-interrupt.sh exec git init diff --git a/testdata/sh_syntax_in_files.txt b/testdata/sh_syntax_in_files.txt index a45c9a25..18e4e037 100644 --- a/testdata/sh_syntax_in_files.txt +++ b/testdata/sh_syntax_in_files.txt @@ -3,7 +3,9 @@ exec lefthook install exec git config user.email "you@example.com" exec git config user.name "Your Name" -exec lefthook run echo_files +[unix] exec lefthook run echo_files +[windows] exec lefthook run echo_files_windows + stdout '1.txt 10.txt' -- lefthook.yml -- @@ -22,6 +24,12 @@ echo_files: files: ls | grep 1 run: echo {files} +echo_files_windows: + commands: + echo: + files: dir | findstr "1" + run: echo {files} + -- 1.txt -- 1.txt diff --git a/testdata/skip_run.txt b/testdata/skip_run.txt index 0db312bb..7e2af672 100644 --- a/testdata/skip_run.txt +++ b/testdata/skip_run.txt @@ -1,3 +1,5 @@ +[windows] skip + exec git init exec git add -A exec lefthook run skip @@ -5,14 +7,12 @@ exec lefthook run skip exec lefthook run no-skip stdout 'Ha-ha!' -[unix] exec lefthook run skip-var -[windows] exec lefthook run skip-var-windows +exec lefthook run skip-var ! stdout 'Ha-ha!' env VAR=1 -[unix] exec lefthook run skip-var -[windows] exec lefthook run skip-var-windows - stdout 'Ha-ha!' +exec lefthook run skip-var +stdout 'Ha-ha!' -- lefthook.yml -- skip_output: @@ -40,10 +40,3 @@ skip-var: commands: echo: run: echo 'Ha-ha!' - -skip-var-windows: - skip: - - run: if (-not $env:VAR) { exit 1 } else { exit 0 } - commands: - echo: - run: echo 'Ha-ha!' diff --git a/testdata/skip_run_windows.txt b/testdata/skip_run_windows.txt new file mode 100644 index 00000000..39f5833e --- /dev/null +++ b/testdata/skip_run_windows.txt @@ -0,0 +1,42 @@ +[!windows] skip + +exec git init +exec git add -A +exec lefthook run skip +! stdout 'Ha-ha!' +exec lefthook run no-skip +stdout 'Ha-ha!' + +exec lefthook run skip-var +! stdout 'Ha-ha!' + +env VAR=1 +exec lefthook run skip-var +stdout 'Ha-ha!' + +-- lefthook.yml -- +skip_output: + - skips + - meta + - summary + - execution_info +skip: + skip: + - run: powershell -Command "if (1 -eq 1) { exit 0 } else { exit 1 }" + commands: + echo: + run: echo 'Ha-ha!' + +no-skip: + skip: + - run: powershell -Command "if (1 -eq 0) { exit 0 } else { exit 1 }" + commands: + echo: + run: echo 'Ha-ha!' + +skip-var: + skip: + - run: powershell -Command "if ([string]::IsNullOrEmpty($env:VAR)) { exit 0 } else { exit 1 }" + commands: + echo: + run: echo 'Ha-ha!'