mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
allow pre-commit.php to work without changes (#9597)
* allow pre-commit.php to work without changes * make it actually work :D
This commit is contained in:
@@ -13,7 +13,7 @@ if (getenv('FILES')) {
|
||||
$changed_files = exec("git diff --diff-filter=d --name-only master | tr '\n' ' '|sed 's/,*$//g'");
|
||||
}
|
||||
|
||||
$changed_files = explode(' ', $changed_files);
|
||||
$changed_files = $changed_files ? explode(' ', $changed_files) : [];
|
||||
|
||||
$map = [
|
||||
'docs' => 0,
|
||||
@@ -122,13 +122,13 @@ if (check_opt($options, 'db')) {
|
||||
}
|
||||
|
||||
// No php files, skip the php checks.
|
||||
if ($map['php'] === 0) {
|
||||
if (!empty($changed_files) && $map['php'] === 0) {
|
||||
putenv('SKIP_LINT_CHECK=1');
|
||||
putenv('SKIP_STYLE_CHECK=1');
|
||||
}
|
||||
|
||||
// If we have no php files and no OS' found then also skip unit checks.
|
||||
if ($map['php'] === 0 && empty($map['os']) && !$os) {
|
||||
if (!empty($changed_files) && $map['php'] === 0 && empty($map['os']) && !$os) {
|
||||
putenv('SKIP_UNIT_CHECK=1');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user