The branch, master on karma.git has been updated
       via  0f16aa9900ae3360fe65c11a031f08082bae37fa (commit)
      from  e8ea9bb51969db576a4a058ff3ab1d8d73433ec6 (commit)

http://git.php.net/?p=karma.git;a=log;h=0f16aa9900ae3360fe65c11a031f08082bae37fa;hp=e8ea9bb51969db576a4a058ff3ab1d8d73433ec6

Summary of changes: 
http://git.php.net/?p=karma.git;a=log;h=0f16aa9900ae3360fe65c11a031f08082bae37fa;hp=e8ea9bb51969db576a4a058ff3ab1d8d73433ec6
 hooks/pre-receive       |    8 ++------
 lib/Git/ReceiveHook.php |   10 ++++++++++
 2 files changed, 12 insertions(+), 6 deletions(-)

-- Log ----------------------------------------
commit 0f16aa9900ae3360fe65c11a031f08082bae37fa
Author: David Soria Parra <d...@php.net>
Date:   Sun Jan 22 04:04:56 2012 +0100

    Don't handle karma for repositories that have karma.ignored set to true
    
    Instead of maintaining our own list, we just use git configs. If 
karma.ignored
    is set to true, we do not check karma.

diff --git a/hooks/pre-receive b/hooks/pre-receive
index 3a4136b..a687a77 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -9,9 +9,6 @@
  */
 namespace Karma;
 
-/* gitolite admin is ignored as access is handled by gitolite acls itself */
-$ignored_repos = ['gitolite-admin.git'];
-
 const KARMA_FILE = '/git/checkout/SVNROOT/global_avail';
 const REPOSITORY_PATH = '/git/repositories';
 
@@ -106,9 +103,8 @@ fprintf(STDOUT, "Welcome $user.\n");
 $hook = new \Git\ReceiveHook(getenv('PHP_KARMA_FILE') ?: KARMA_FILE,
                              getenv('GL_REPO_BASE_ABS') ?: REPOSITORY_PATH);
 
-if (in_array($hook->getRepositoryName(), $ignored_repos)) {
-    /* the repository should not be handled */
-    exit(0);
+if ($hook->isKarmaIgnored()) {
+    accept("No karma check necessary. Thank you for your contribution.\n");
 }
 
 $requested_paths = $hook->getReceivedPaths();
diff --git a/lib/Git/ReceiveHook.php b/lib/Git/ReceiveHook.php
index 8022304..6776a2a 100644
--- a/lib/Git/ReceiveHook.php
+++ b/lib/Git/ReceiveHook.php
@@ -16,6 +16,16 @@ class ReceiveHook
     }
 
     /**
+     * Returns true if git option karma.ignored is set, otherwise false.
+     *
+     * @return boolean
+     */
+    public function isKarmaIgnored()
+    {
+        return 'true' === exec(sprintf('%s config karma.ignored', 
self::GIT_EXECUTABLE));
+    }
+
+    /**
      * Returns the repository name.
      *
      * A repository name is the path to the repository without the .git.

Thank you for your contribution.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to