Skip to content

Commit 98fe07a

Browse files
[ BugFix ] Ensure executable on update (#79)
* Adds Hook::ensureExecutable() method * ensure that updated hooks are executable
1 parent 05af0d7 commit 98fe07a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/Commands/Update.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function handle(): int
3535
}
3636

3737
$hook->install();
38+
$hook->ensureExecutable();
3839

3940
if ($this->option('verbose')) {
4041
$this->info("{$hook->name} git hook installed successfully.");

app/Hook.php

+10
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ public function enable(): void
8585
File::put(Platform::cwd(".git/hooks/{$this->hook}"), '#!/bin/sh'.PHP_EOL);
8686
}
8787

88+
/**
89+
* Ensure the hook is executable.
90+
*/
91+
public function ensureExecutable(): void
92+
{
93+
if ((new Platform)->isNotWindows()) {
94+
exec('chmod +x '.Platform::cwd(".git/hooks/{$this->hook}"));
95+
}
96+
}
97+
8898
/**
8999
* Checks if the hook uses Whisky.
90100
*/

0 commit comments

Comments
 (0)