com karma: Exclude all pushed refs from revchecks: lib/Git/PostReceiveHook.php
| From: | David Soria Parra | Date: | Thu, 22 Mar 2012 06:54:12 +0000 |
| Subject: | com karma: Exclude all pushed refs from revchecks: lib/Git/PostReceiveHook.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68123@lists.php.net to get a copy of this message | ||
Commit: b9eaafaca29082302885facb1006d8241730d9a4
Author: David Soria Parra <dsp@php.net> Thu, 22 Mar 2012 07:54:12 +0100
Parents: 3325644c596ede37db63958c1c88d4f321138f35
Branches: dsp/playground
Link: http://git.php.net/?p=karma.git;a=commitdiff;h=b9eaafaca29082302885facb1006d8241730d9a4
Log:
Exclude all pushed refs from revchecks
Make sure we exclude new branches from checks if a revision is already
committed as well.
Changed paths:
M lib/Git/PostReceiveHook.php
Diff:
b9eaafaca29082302885facb1006d8241730d9a4
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index 9a380a7..e9d9d74 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -69,6 +69,7 @@ class PostReceiveHook extends ReceiveHook
//cache list of old and updated branches
$newBranches = [];
+ $branches = [];
foreach ($this->refs as $ref) {
if ($ref['reftype'] == self::REF_BRANCH){
if ($ref['changetype'] == self::TYPE_UPDATED) {
@@ -76,6 +77,7 @@ class PostReceiveHook extends ReceiveHook
} elseif ($ref['changetype'] == self::TYPE_CREATED) {
$newBranches[] = $ref['refname'];
}
+ $branches[] = $ref['refname'];
}
}
@@ -93,7 +95,7 @@ class PostReceiveHook extends ReceiveHook
}
}
- $unpushedBranches = array_diff($this->allBranches, $this->updatedBranches);
+ $unpushedBranches = array_diff($this->allBranches, $branches);
foreach (array_unique($revisions) as $revision) {
if (!$this->isRevExistsInBranches($revision, $unpushedBranches)) {
$this->sendCommitMail($revision);