Skip to content

Commit aa0f27c

Browse files
committed
Try removing Git for Windows PATH directories
In the `test-fast` Windows jobs, this removes descendant directories under the directory where Git for Windows is installed on CI Windows runners, from the `PATH` environment variable. This is done after the full test suite run. The idea is to support running some specific tests, where `gix-path` will have to find `git` by checking common locations. But this does rerun any tests yet. The other change this makes is to remove the CI runner PATH search instrumentation steps in `test-fast` and `test-fixtures-windows` that were just previously added. (Those steps were added temporarily to examine how this change should be made, and they are no longer needed.)
1 parent ddf6297 commit aa0f27c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,6 @@ jobs:
220220
runs-on: ${{ matrix.os }}
221221

222222
steps:
223-
- name: Show PATH
224-
if: startsWith(matrix.os, 'windows')
225-
run: $Env:PATH -split ';'
226-
- name: Find git
227-
if: startsWith(matrix.os, 'windows')
228-
run: where.exe git
229223
- uses: actions/checkout@v4
230224
- name: Install rustup
231225
if: matrix.os == 'windows-11-arm'
@@ -244,6 +238,17 @@ jobs:
244238
run: cargo nextest run --workspace --no-fail-fast -- ${{ matrix.test-args }}
245239
- name: Check that tracked archives are up to date
246240
run: git diff --exit-code # If this fails, the fix is usually to commit a regenerated archive.
241+
- name: Remove Git for Windows directories from PATH
242+
if: startsWith(matrix.os, 'windows')
243+
run: |
244+
$prefix = 'C:\Program Files\Git'
245+
$filtered = ($Env:PATH -split ';' | Where-Object { $_ -notlike "$prefix\*" }) -join ';'
246+
Add-Content -Value "PATH=$filtered" -Path $Env:GITHUB_ENV
247+
- name: Check that `git` is no longer found
248+
if: startsWith(matrix.os, 'windows')
249+
run: |
250+
$git = Get-Command git -ErrorAction SilentlyContinue
251+
if ($null -eq $git) { exit 0 } else { exit 1 }
247252
248253
test-fixtures-windows:
249254
strategy:
@@ -259,12 +264,6 @@ jobs:
259264
runs-on: ${{ matrix.os }}
260265

261266
steps:
262-
- name: Show PATH
263-
if: startsWith(matrix.os, 'windows')
264-
run: $Env:PATH -split ';'
265-
- name: Find git
266-
if: startsWith(matrix.os, 'windows')
267-
run: where.exe git
268267
- name: Report version/build of Git in this runner image
269268
run: git version --build-options
270269
- name: Upgrade Git for Windows to latest stable release

0 commit comments

Comments
 (0)