From 0bca3ecb929411c349e4581f8a2559d2b495b9b7 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 13:48:35 +0200 Subject: [PATCH 01/14] Adjusted hook tests to work on windows --- asyncgit/src/sync/hooks.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/asyncgit/src/sync/hooks.rs b/asyncgit/src/sync/hooks.rs index 6b34a1b8ea..35b065ba07 100644 --- a/asyncgit/src/sync/hooks.rs +++ b/asyncgit/src/sync/hooks.rs @@ -183,8 +183,7 @@ mod tests { let root = repo.path().parent().unwrap(); let repo_path = root.as_os_str().to_str().unwrap(); - let hook = b" -#!/bin/sh + let hook = b"#!/bin/sh exit 0 "; @@ -204,8 +203,7 @@ exit 0 let root = repo.path().parent().unwrap(); let repo_path = root.as_os_str().to_str().unwrap(); - let hook = b" -#!/bin/sh + let hook = b"#!/bin/sh echo 'msg' > $1 echo 'rejected' exit 1 @@ -230,8 +228,7 @@ exit 1 let root = repo.path().parent().unwrap(); // let repo_path = root.as_os_str().to_str().unwrap(); - let hook = b" -#!/bin/sh + let hook = b"#!/bin/sh echo 'msg' > $1 echo 'rejected' exit 1 @@ -261,8 +258,7 @@ exit 1 let root = repo.path().parent().unwrap(); let repo_path = root.as_os_str().to_str().unwrap(); - let hook = b" -#!/bin/sh + let hook = b"#!/bin/sh echo 'msg' > $1 exit 0 "; @@ -281,8 +277,7 @@ exit 0 let (_td, repo) = repo_init().unwrap(); let root = repo.path().parent().unwrap(); - let hook = b" -#!/bin/sh + let hook = b"#!/bin/sh echo 'rejected' exit 1 "; From 7d3c726b0d49f855f9de3a5a246f1e37ae07ced3 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:08:03 +0200 Subject: [PATCH 02/14] Try installing git on windows --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0006feb3c5..f415cdbc3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,11 @@ jobs: # run: | # choco install wsl-ubuntu-1804 + - name: Windows Setup + if: matrix.os == 'windows-latest' + run: | + choco install git + - name: Install Rust uses: actions-rs/toolchain@v1 with: From 1748ec72ae3b18b8b713dbee9986156c364de895 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:28:11 +0200 Subject: [PATCH 03/14] Apply path fix to make git bash available --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f415cdbc3a..f0b50e99f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,9 @@ jobs: - name: Windows Setup if: matrix.os == 'windows-latest' - run: | - choco install git + env: + # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ + Path: "C:\Program Files\Git\bin;${{ env.Path }}" - name: Install Rust uses: actions-rs/toolchain@v1 From 51d96214942c49ebbd942379cff43172d7daaa5f Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:38:52 +0200 Subject: [PATCH 04/14] Another try --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0b50e99f1..cea11b092a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: - name: Windows Setup if: matrix.os == 'windows-latest' - env: + run: | # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ - Path: "C:\Program Files\Git\bin;${{ env.Path }}" + echo "::set-env name=Path::"C:\Program Files\Git\bin;${{ env.Path }}" - name: Install Rust uses: actions-rs/toolchain@v1 From de1dea4998f242c3a584bdd591f6d10de26284ed Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:40:51 +0200 Subject: [PATCH 05/14] Fixed environment setup --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cea11b092a..b72623fb70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: - name: Windows Setup if: matrix.os == 'windows-latest' + # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | - # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ - echo "::set-env name=Path::"C:\Program Files\Git\bin;${{ env.Path }}" + echo "::set-env name=Path::C:\Program Files\Git\bin;${{ env.Path }}" - name: Install Rust uses: actions-rs/toolchain@v1 From 47308f5f022dc9c72fb6e226dcd13b89f1c28ddc Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:43:59 +0200 Subject: [PATCH 06/14] Environment reference --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b72623fb70..12135cc971 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: if: matrix.os == 'windows-latest' # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | - echo "::set-env name=Path::C:\Program Files\Git\bin;${{ env.Path }}" + echo "::set-env name=Path::C:\Program Files\Git\bin;$Path" - name: Install Rust uses: actions-rs/toolchain@v1 From 6285c285836942034f811a4d42292d5a5ba711db Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:45:32 +0200 Subject: [PATCH 07/14] Path environment --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12135cc971..51fe099683 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: if: matrix.os == 'windows-latest' # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | - echo "::set-env name=Path::C:\Program Files\Git\bin;$Path" + echo "::set-env name=Path::C:\Program Files\Git\bin;${{ env.PATH }}" - name: Install Rust uses: actions-rs/toolchain@v1 From a3ad271751571ac517c9902239a5745c1a1a9ec1 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Sun, 16 Aug 2020 15:47:56 +0200 Subject: [PATCH 08/14] Switch to add-path command --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51fe099683..acc3e4bc32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: if: matrix.os == 'windows-latest' # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | - echo "::set-env name=Path::C:\Program Files\Git\bin;${{ env.PATH }}" + echo "::add-path::C:\Program Files\Git\bin" - name: Install Rust uses: actions-rs/toolchain@v1 From 256bdce415e367d24dd0f4f37952b6e7df0a6b61 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Tue, 18 Aug 2020 18:55:00 +0200 Subject: [PATCH 09/14] Test Path changes --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acc3e4bc32..5d095944cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | echo "::add-path::C:\Program Files\Git\bin" + echo ${{ env.Path }} - name: Install Rust uses: actions-rs/toolchain@v1 From 0eeecc0ab014a8f88872f7a467b3089bbbdbfa58 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Tue, 18 Aug 2020 18:59:27 +0200 Subject: [PATCH 10/14] Test path2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d095944cd..638cd714c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | echo "::add-path::C:\Program Files\Git\bin" - echo ${{ env.Path }} + echo $Env:Path - name: Install Rust uses: actions-rs/toolchain@v1 From 8f21e59ea441c03c5b4d5944867b81f0925aab20 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Tue, 18 Aug 2020 19:06:01 +0200 Subject: [PATCH 11/14] Find out --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 638cd714c3..006661b854 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: run: | echo "::add-path::C:\Program Files\Git\bin" echo $Env:Path + Get-Command bash + - name: Install Rust uses: actions-rs/toolchain@v1 From 9a4f687a4023c957e20fe062d0b4f724d94ab760 Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Tue, 18 Aug 2020 19:15:50 +0200 Subject: [PATCH 12/14] Without add-path --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 006661b854..9cc7d60a77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,6 @@ jobs: if: matrix.os == 'windows-latest' # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ run: | - echo "::add-path::C:\Program Files\Git\bin" echo $Env:Path Get-Command bash From 4a362fb5b62ba7271255038e8aead4aadb3f627f Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Tue, 18 Aug 2020 19:27:56 +0200 Subject: [PATCH 13/14] Undo unnecessary ci.yml changes --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc7d60a77..0006feb3c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,14 +24,6 @@ jobs: # run: | # choco install wsl-ubuntu-1804 - - name: Windows Setup - if: matrix.os == 'windows-latest' - # https://codeblog.jonskeet.uk/2019/10/12/using-git-bash-from-appveyor/ - run: | - echo $Env:Path - Get-Command bash - - - name: Install Rust uses: actions-rs/toolchain@v1 with: From 5e1919b7a032494c6cf59cb14d67ac79b2500b9f Mon Sep 17 00:00:00 2001 From: dr-BEat Date: Tue, 18 Aug 2020 20:46:10 +0200 Subject: [PATCH 14/14] Fix Command::new behaviour on windows --- asyncgit/src/sync/hooks.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/asyncgit/src/sync/hooks.rs b/asyncgit/src/sync/hooks.rs index 35b065ba07..271e93d38b 100644 --- a/asyncgit/src/sync/hooks.rs +++ b/asyncgit/src/sync/hooks.rs @@ -105,6 +105,7 @@ fn run_hook( let output = Command::new("bash") .args(bash_args) .current_dir(path) + .env("DUMMYENV", "FixPathHandlingOnWindows") // This call forces Command to handle the Path environment correctly on windows, the specific env set here does not matter .output(); let output = output.expect("general hook error");