com karma: Merge branch 'master' of http://y3.php.net/repository/karma: hooks/pre-receive
| From: | David Soria Parra | Date: | Fri, 22 Jun 2012 16:57:57 +0000 |
| Subject: | com karma: Merge branch 'master' of http://y3.php.net/repository/karma: hooks/pre-receive | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69431@lists.php.net to get a copy of this message | ||
Commit: 23895febd33b8a72cc7326aba1b54ac4c192d311
Author: David Soria Parra <dsp@php.net> Fri, 22 Jun 2012 18:57:57 +0200
Parents: 8141a722ca06536b935419df3111fd721d996053 0f4a8cdd72b0fabce293a9206db6b5710cbc9d76
Branches: master
Link: http://git.php.net/?p=karma.git;a=commitdiff;h=23895febd33b8a72cc7326aba1b54ac4c192d311
Log:
Merge branch 'master' of http://y3.php.net/repository/karma
Conflicts:
lib/Git/ReceiveHook.php
Changed paths:
MM hooks/pre-receive
Diff:
diff --cc hooks/pre-receive
index 9ee9be8,b23fb2c..9b15699
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@@ -122,17 -118,9 +122,17 @@@ $pi = new \Git\PushInformation($
$req_paths = ($pi->isNewBranch() || $pi->isForced() || $pi->isTag()) ? [''] :
$hook->getReceivedPaths();
if (empty($req_paths)) {
- deny("We cannot figure out what you comitted!");
+ $req_paths = ['']; // we can empty paths for trivial merge
}
+$restricted = array_filter($restrictedBranches[$repo_name], function ($branch) {
+ return in_array($branch, $hook->getAllBranches());
+});
+
+if (count($restricted) && $pi->isForced()) {
+ deny("You are allowed to overwrite commits on " . implode(', ',
$restricted));
+}
+
$prefix = sprintf('%s/', $repo_name);
$avail_lines = $hook->getKarmaFile();
$req_paths = array_map(function ($x) use ($prefix) { return $prefix . $x;}, $req_paths);