Skip to content

Commit

Permalink
feat: restore execute mode on already-tracked files
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Nov 9, 2018
1 parent 71d9416 commit 78aa57a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions php-classes/Emergence/Git/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,22 @@ public function syncFromVfs()
$results[$treeOptions['vfsPath']] = $result;
}

// analyze mode changes
$diff = $this->getRepository()->run('diff', ['--summary']);
$diff = explode(PHP_EOL, $diff);

foreach ($diff as $diffLine) {
$diffLine = trim($diffLine);

if (!preg_match('/^mode change (?<modeFrom>\d+) => (?<modeTo>\d+) (?<path>.+?)$/', $diffLine, $matches)) {
continue;
}

if ($matches['modeFrom'] == '100755') {
chmod($matches['path'], 0755);
}
}

return $results;
}

Expand Down

0 comments on commit 78aa57a

Please sign in to comment.