Skip to content

Commit

Permalink
Fix Windows support for ExecDriver (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
markwalet committed Nov 27, 2023
1 parent 7773d5a commit 66d33e0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: coverage

on: [push, pull_request]

jobs:
windows-test:
runs-on: windows-latest

name: Windows test

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-8.3-illuminate-10.*-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, fileinfo, pdo, sqlite, pdo_sqlite, gd
coverage: xdebug

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Calculate coverage statistics
run: vendor/bin/phpunit --coverage-clover 'clover.xml'

- name: Send coverage statistics
uses: codecov/codecov-action@v1
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
## [Unreleased](https://github.com/markwalet/laravel-git-state/compare/v1.7.0...master)

### Added
- Added support for PHP 8.3
- Added support for PHP 8.3.

### Fixed
- Fixed Windows support for ExecDriver.

## [v1.7.0 (2023-02-17)](https://github.com/markwalet/laravel-git-state/compare/v1.6.1...v1.7.0)

Expand Down
4 changes: 3 additions & 1 deletion src/Drivers/ExecGitDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ private function command(string $command, array $options = []): string
'--git-dir' => $this->folder,
]);

return "git $gitOptions $command $commandOptions 2>/dev/null";
$nullDevice = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? '/nul' : '/dev/null';

return "git $gitOptions $command $commandOptions 2>$nullDevice";
}

/**
Expand Down

0 comments on commit 66d33e0

Please sign in to comment.