From 6faf55527a17fb569456709c2769a6d8749ceb6d Mon Sep 17 00:00:00 2001 From: Jan Pecha Date: Tue, 17 Apr 2018 10:52:47 +0200 Subject: [PATCH] GitRepository: fixed hasChanges() (see #25) Result of hasChanges() was depend on user locale. --- src/GitRepository.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GitRepository.php b/src/GitRepository.php index f3b32e7..5d87e3e 100644 --- a/src/GitRepository.php +++ b/src/GitRepository.php @@ -386,10 +386,8 @@ public function hasChanges() ->run('git update-index -q --refresh') ->end(); - $this->begin(); - $lastLine = exec('git status'); - $this->end(); - return (strpos($lastLine, 'nothing to commit')) === FALSE; // FALSE => changes + $output = $this->extractFromCommand('git status --porcelain'); + return !empty($output); }