1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00

Never try to run README as a commit hook

Summary:
Fixes T4960. Users `chmod +x` this, and then bash chokes on it.

Phabricator "owns" this file anyway, so there is no real ambiguity here: this should never be a hook script.

Test Plan:
  - Did `chmod +x README`.
  - Made a commit.
  - Added `z.sh`, got blocked.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T4960

Differential Revision: https://secure.phabricator.com/D8981
This commit is contained in:
epriestley 2014-05-05 10:54:53 -07:00
parent ac9c82fcdf
commit 74faacee4d

View file

@ -637,9 +637,19 @@ final class DiffusionCommitHookEngine extends Phobject {
foreach (Filesystem::listDirectory($directory) as $path) { foreach (Filesystem::listDirectory($directory) as $path) {
$full_path = $directory.DIRECTORY_SEPARATOR.$path; $full_path = $directory.DIRECTORY_SEPARATOR.$path;
if (is_executable($full_path)) { if (!is_executable($full_path)) {
$executables[] = $full_path; // Don't include non-executable files.
continue;
} }
if (basename($full_path) == 'README') {
// Don't include README, even if it is marked as executable. It almost
// certainly got caught in the crossfire of a sweeping `chmod`, since
// users do this with some frequency.
continue;
}
$executables[] = $full_path;
} }
return $executables; return $executables;