[PHP-CVS] [git] karma.git branch master updated. 0b0820c

2012-03-18 Thread dsp
The branch master on karma.git has been updated
   via  0b0820cdba2232799df7918e198ca4acf7bfe9fe (commit)
   via  186bf0765eedc06ef7ec590089d997efeda72d64 (commit)
   via  7c4de5d5a9e10eb0322d87e69f07e32ad843de60 (commit)
   via  34f6910a46bbdaf32871f9cb1cda1c41d26ca96f (commit)
   via  f2e733020f4a75f4a91b88ea73c0c8c77f455d5c (commit)
   via  3cb77b79f3dc1a5a77cb3c4348b7a14b3e29aca2 (commit)
   via  cffd3b39b05fae71090586fcc9f717f857c20ae0 (commit)
   via  99a863d4846676c53e15031cdc217c264aa082f8 (commit)
   via  91e9caf26371fc75f01faa4a1e7f0a9729313c4e (commit)
   via  8965fe78b0a0e1a1fca87677183472a8eb0ae8e9 (commit)
   via  57727b422a5df298c6db0ba73d2aa4eab3b76fb8 (commit)
   via  b8e2e76374106a75687c430597ac8a352c7e514e (commit)
   via  30a1031bfb19338e8eb5cfabc72c7352d6f38a18 (commit)
   via  a7fabb3c3cf3274a48efe8d7ae948af68984f0d1 (commit)
   via  4d61fb520544f543d8c6120fb02548de4bfc2f06 (commit)
   via  fc047465fda04319c5a14707d7709fff1f2a3f57 (commit)
   via  b1240df188897323ee2c550d62fcab4a245bec37 (commit)
   via  8507e88c7abde403c9bdf1b385d5d4f2b284d1f3 (commit)
   via  509b56df21c8cd0ee971c9580adadc00379df8b1 (commit)
   via  454db4da98f95049825b3a9018542d709136a7bc (commit)
   via  e41adefbee4ab8758d42a360eeaecd5e22bb7e30 (commit)
   via  46adcc9c1571d5a20660ca49b2762189a1495786 (commit)
   via  c7163b23683f8656f913ff4d22706ca5a5f41380 (commit)
   via  67c322fe22b0cb6f561711a4041325974b9bfc31 (commit)
   via  b841aacab5e1e9af103b1d38e11822debda5ea22 (commit)
   via  89a2d90e9e5d2e8a661b91c1fdb3f32cf2d90cdd (commit)
   via  5d58ad7ac1700df5ad7d9bf50b73b80b71ce9844 (commit)
   via  373c2053d9ac29ab7d2750b25e939a5b4a0dfc17 (commit)
  from  fc9c78fe12aa756060684e565adf8fb8a4373120 (commit)

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

Summary of changes:
 README.POST_RECEIVE_MAIL|  119 +++
 hooks/post-receive  |  753 +--
 hooks/post-receive.mail |   50 +++
 hooks/pre-receive   |6 +-
 lib/Git.php |   28 ++-
 lib/Git/PostReceiveHook.php |  573 
 lib/Git/PreReceiveHook.php  |   75 +
 lib/Git/PushInformation.php |   28 +-
 lib/Git/ReceiveHook.php |  186 ++--
 lib/Mail.php|  185 +++
 10 files changed, 1136 insertions(+), 867 deletions(-)
 create mode 100644 README.POST_RECEIVE_MAIL
 create mode 100755 hooks/post-receive.mail
 create mode 100644 lib/Git/PostReceiveHook.php
 create mode 100644 lib/Git/PreReceiveHook.php
 create mode 100644 lib/Mail.php

-- Log 
commit 0b0820cdba2232799df7918e198ca4acf7bfe9fe
Merge: 186bf07 7c4de5d
Author: David Soria Parra d...@php.net
Date:   Sun Mar 18 16:30:22 2012 +0100

Merge remote-tracking branch 'origin/PHP_POST_RECEIVE'

Conflicts:
lib/Git/ReceiveHook.php

diff --cc hooks/pre-receive
index 424ce41,250b609..95224ff
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@@ -111,9 -112,10 +112,10 @@@ if ($hook-isKarmaIgnored()) 
  accept(No karma check necessary. Thank you for your contribution.\n);
  }
  
+ $hook-hookInput();
  $repo_name = $hook-getRepositoryName();
  $pi= new \Git\PushInformation($hook);
 -$req_paths = ($pi-isForced()) ? [''] : $hook-getReceivedPaths();
 +$req_paths = ($pi-isForced() || $pi-isTag()) ? [''] : 
$hook-getReceivedPaths();
  
  if (empty($req_paths)) {
  deny(We cannot figure out what you comitted!);
diff --cc lib/Git/PreReceiveHook.php
index 000,eb0c609..be707ad
mode 00,100644..100644
--- a/lib/Git/PreReceiveHook.php
+++ b/lib/Git/PreReceiveHook.php
@@@ -1,0 -1,75 +1,75 @@@
+ ?php
+ namespace Git;
+ 
+ class PreReceiveHook extends ReceiveHook
+ {
+ 
+ private $karmaFile;
+ 
+ public function __construct($karma_file, $base_path)
+ {
+ parent::__construct($base_path);
+ $this-karmaFile = $karma_file;
+ }
+ 
+ /**
+ * Returns true if git option karma.ignored is set, otherwise false.
+ *
+ * @return boolean
+ */
+ public function isKarmaIgnored()
+ {
+ return 'true' === \Git::gitExec('config karma.ignored');
+ }
+ 
+ public function mapInput(callable $fn) {
+ $result = [];
+ foreach($this-refs as $input) {
 -$result[] = $fn($input['old'], $input['new']);
++$result[] = $fn($input['old'], $input['new'], $input['refname']);
+ }
+ 
+ return $result;
+ }
+ 
+ /**
+ * Return the content of the karma file from the karma repository.
+ *
+ * We read the content of the karma file from the karma repository index.
+ *
+ * @return string
+ */
+ public function getKarmaFile()
+ {
+ return file($this-karmaFile);
+ }
+ 
+ public function 

[PHP-CVS] [git] karma.git branch master updated. c388fdc

2012-03-06 Thread dsp
The branch, master on karma.git has been updated
  discards  002a63c12dc1eadb3885d9fc5c6b97cf3863913a (commit)
   via  c388fdc594d5cf8f8f695eef47c179e2e1acc39e (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (002a63c12dc1eadb3885d9fc5c6b97cf3863913a)
\
 N -- N -- N (c388fdc594d5cf8f8f695eef47c179e2e1acc39e)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.php.net/?p=karma.git;a=log;h=c388fdc594d5cf8f8f695eef47c179e2e1acc39e;hp=002a63c12dc1eadb3885d9fc5c6b97cf3863913a

Summary of changes:
 hooks/pre-receive |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

-- Log 
commit c388fdc594d5cf8f8f695eef47c179e2e1acc39e
Author: David Soria Parra d...@php.net
Date:   Fri Mar 2 03:06:30 2012 +0100

Require access to all the repository in case we do a forced push

A forced push can happen when you delete a tag or rewrite commits. We allow
this, but only if you have access to the root of the repository.

diff --git a/hooks/pre-receive b/hooks/pre-receive
index 46195a4..6a7c29f 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -11,11 +11,15 @@ namespace Karma;
 
 const KARMA_FILE = '/git/checkout/SVNROOT/global_avail';
 const REPOSITORY_PATH = '/git/repositories';
+const LIB_PATH = '/git/checkout/karma/lib';
 
-set_include_path('/git/checkout/karma/lib' .
+set_include_path(
+getenv('KARMA_LIB_PATH') ?: LIB_PATH .
 PATH_SEPARATOR .
 get_include_path());
 
+include 'Git.php';
+include 'Git/PushInformation.php';
 include 'Git/ReceiveHook.php';
 
 function deny($reason)
@@ -107,16 +111,18 @@ if ($hook-isKarmaIgnored()) {
 accept(No karma check necessary. Thank you for your contribution.\n);
 }
 
-$requested_paths = $hook-getReceivedPaths();
+$repo_name = $hook-getRepositoryName();
+$pi= new \Git\PushInformation($hook);
+$req_paths = ($pi-isForced()) ? [''] : $hook-getReceivedPaths();
 
-if (empty($requested_paths)) {
+if (empty($req_paths)) {
 deny(We cannot figure out what you comitted!);
 }
 
-$prefix  = sprintf('%s/', $hook-getRepositoryName());
+$prefix  = sprintf('%s/', $repo_name);
 $avail_lines = $hook-getKarmaFile();
-$requested_paths = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $requested_paths);
-$unavail_paths   = get_unavail_paths($user, $requested_paths, $avail_lines);
+$req_paths   = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $req_paths);
+$unavail_paths   = get_unavail_paths($user, $req_paths, $avail_lines);
 
 if (!empty($unavail_paths)) {
 deny(sprintf(
diff --git a/lib/Git/PushInformation.php b/lib/Git/PushInformation.php
new file mode 100644
index 000..edf73dc
--- /dev/null
+++ b/lib/Git/PushInformation.php
@@ -0,0 +1,86 @@
+?php
+namespace Git;
+
+class PushInformation
+{
+const GIT_EXECUTABLE = 'git';
+
+private $karmaFile;
+private $repositoryBasePath;
+
+private $hook= null;
+private $repourl = null;
+
+public function __construct(ReceiveHook $hook)
+{
+$this-repourl = \Git::getRepositoryPath();
+$this-hook= $hook;
+}
+
+/**
+ * Returns the common ancestor revision for two given revisions
+ *
+ * Returns false if no sha1 was returned. Throws an exception if calling
+ * git fails.
+ *
+ * @return boolean
+ */
+protected function mergeBase($oldrev, $newrev)
+{
+$baserev = exec(sprintf('%s --git-dir=%s merge-base %s %s',
+\Git::GIT_EXECUTABLE,
+$this-repourl,
+escapeshellarg($oldrev),
+escapeshellarg($newrev)), $output, $retval);
+
+$baserev = trim($baserev);
+
+if (0 !== $retval) {
+throw new \Exception('Failed to call git');
+}
+
+if (40 != strlen($baserev)) {
+return false;
+}
+
+return $baserev;
+}
+
+/**
+ * Returns true if merging $newrev would be fast forward
+ *
+ * @return boolean
+ */
+public function isFastForward()
+{
+$result = $this-hook-mapInput(
+function ($oldrev, $newrev) {
+if ($oldrev == \Git::NULLREV) {
+return true;
+}
+return $oldrev == $this-mergeBase($oldrev, $newrev);
+});
+
+return array_reduce($result, function($a, $b) { return $a  $b; }, 
true);
+}
+
+/**
+ * Returns true if updating the refs would fail if push is not forced.
+ *
+ * @return boolean
+ */
+public 

[PHP-CVS] [git] karma.git branch master updated. 002a63c

2012-03-03 Thread dsp
The branch, master on karma.git has been updated
   via  002a63c12dc1eadb3885d9fc5c6b97cf3863913a (commit)
   via  f3d11575dc77ab1cc7eda290a4366122b923b1c1 (commit)
   via  51ca66d43a28b1c50cfd4e994712bc577e440e52 (commit)
   via  c358027fd70d57b60f12b620dc78f6fe7c384aec (commit)
  from  8d595325d65b7de86651483a1705a0ee2a4b4bd5 (commit)

http://git.php.net/?p=karma.git;a=log;h=002a63c12dc1eadb3885d9fc5c6b97cf3863913a;hp=8d595325d65b7de86651483a1705a0ee2a4b4bd5

Summary of changes:
 hooks/pre-receive   |   29 +-
 lib/Git.php |   25 
 lib/Git/PushInformation.php |   86 +++
 lib/Git/ReceiveHook.php |   43 +
 4 files changed, 148 insertions(+), 35 deletions(-)
 create mode 100644 lib/Git.php
 create mode 100644 lib/Git/PushInformation.php

-- Log 
commit 002a63c12dc1eadb3885d9fc5c6b97cf3863913a
Author: David Soria Parra d...@php.net
Date:   Fri Mar 2 03:06:30 2012 +0100

Require access to all the repository in case we do a forced push

A forced push can happen when you delete a tag or rewrite commits. We allow
this, but only if you have access to the root of the repository.

diff --git a/hooks/pre-receive b/hooks/pre-receive
index 46195a4..48da31b 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -11,11 +11,15 @@ namespace Karma;
 
 const KARMA_FILE = '/git/checkout/SVNROOT/global_avail';
 const REPOSITORY_PATH = '/git/repositories';
+const LIB_PATH = '/git/checkout/karma/lib';
 
-set_include_path('/git/checkout/karma/lib' .
+set_include_path(
+getenv('KARMA_LIB_PATH') ?: LIB_PATH .
 PATH_SEPARATOR .
 get_include_path());
 
+include 'Git.php';
+include 'Git/PushInformation.php';
 include 'Git/ReceiveHook.php';
 
 function deny($reason)
@@ -107,16 +111,19 @@ if ($hook-isKarmaIgnored()) {
 accept(No karma check necessary. Thank you for your contribution.\n);
 }
 
-$requested_paths = $hook-getReceivedPaths();
+$repo_name = $hook-getRepositoryName();
+$pi= new \Git\PushInformation($hook);
+$req_paths = ($pi-isForced()) ? [''] : $hook-getReceivedPaths();
+var_dump($pi-isForced());
 
-if (empty($requested_paths)) {
+if (empty($req_paths)) {
 deny(We cannot figure out what you comitted!);
 }
 
-$prefix  = sprintf('%s/', $hook-getRepositoryName());
+$prefix  = sprintf('%s/', $repo_name);
 $avail_lines = $hook-getKarmaFile();
-$requested_paths = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $requested_paths);
-$unavail_paths   = get_unavail_paths($user, $requested_paths, $avail_lines);
+$req_paths   = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $req_paths);
+$unavail_paths   = get_unavail_paths($user, $req_paths, $avail_lines);
 
 if (!empty($unavail_paths)) {
 deny(sprintf(
diff --git a/lib/Git/PushInformation.php b/lib/Git/PushInformation.php
new file mode 100644
index 000..edf73dc
--- /dev/null
+++ b/lib/Git/PushInformation.php
@@ -0,0 +1,86 @@
+?php
+namespace Git;
+
+class PushInformation
+{
+const GIT_EXECUTABLE = 'git';
+
+private $karmaFile;
+private $repositoryBasePath;
+
+private $hook= null;
+private $repourl = null;
+
+public function __construct(ReceiveHook $hook)
+{
+$this-repourl = \Git::getRepositoryPath();
+$this-hook= $hook;
+}
+
+/**
+ * Returns the common ancestor revision for two given revisions
+ *
+ * Returns false if no sha1 was returned. Throws an exception if calling
+ * git fails.
+ *
+ * @return boolean
+ */
+protected function mergeBase($oldrev, $newrev)
+{
+$baserev = exec(sprintf('%s --git-dir=%s merge-base %s %s',
+\Git::GIT_EXECUTABLE,
+$this-repourl,
+escapeshellarg($oldrev),
+escapeshellarg($newrev)), $output, $retval);
+
+$baserev = trim($baserev);
+
+if (0 !== $retval) {
+throw new \Exception('Failed to call git');
+}
+
+if (40 != strlen($baserev)) {
+return false;
+}
+
+return $baserev;
+}
+
+/**
+ * Returns true if merging $newrev would be fast forward
+ *
+ * @return boolean
+ */
+public function isFastForward()
+{
+$result = $this-hook-mapInput(
+function ($oldrev, $newrev) {
+if ($oldrev == \Git::NULLREV) {
+return true;
+}
+return $oldrev == $this-mergeBase($oldrev, $newrev);
+});
+
+return array_reduce($result, function($a, $b) { return $a  $b; }, 
true);
+}
+
+/**
+ * Returns true if updating the refs would fail if push is not forced.
+ *
+ * @return boolean
+ */
+public function isForced()
+{
+$result = $this-hook-mapInput(
+

[PHP-CVS] [git] karma.git branch master updated. 5f74dfc

2012-01-24 Thread dsp
The branch, master on karma.git has been updated
  from  e02dd3d1130c6c5a08bd255a0d97f8d26d27380a (commit)
  to5f74dfca3e51d9529ba499017c887d076a9eb9b3 (commit)

http://git.php.net/?p=karma.git;a=log;h=5f74dfca3e51d9529ba499017c887d076a9eb9b3;hp=e02dd3d1130c6c5a08bd255a0d97f8d26d27380a

Summary of changes:
 hooks/post-receive.mirror |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

-- Log 
commit 5f74dfca3e51d9529ba499017c887d076a9eb9b3
Author: David Soria Parra d...@php.net
Date:   Tue Jan 24 13:15:27 2012 +0100

Calculate pathes based on the repodir

diff --git a/hooks/post-receive.mirror b/hooks/post-receive.mirror
index 450da6a..edc9a68 100755
--- a/hooks/post-receive.mirror
+++ b/hooks/post-receive.mirror
@@ -13,10 +13,7 @@ echo Attempting to push to mirror
 
 if $(echo $target | grep -q REPO);
 then
-#  if [ -z $GL_REPO ];
-#  then
-   GL_REPO=$(pwd | perl -e ' =~ /([^\/]+)\.git$/; print $1;');
-#fi
+   GL_REPO=$(pwd | sed s,/git/repositories/,, | sed s,/,-,g)
# Support a REPO variable for wildcard mirrors
target=$(echo $target | sed -e s,REPO,$GL_REPO,g)
 fi

Thank you for your contribution.

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



[PHP-CVS] [git] karma.git branch master updated. 770cbc6

2012-01-24 Thread dsp
The branch, master on karma.git has been updated
  discards  5f74dfca3e51d9529ba499017c887d076a9eb9b3 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (5f74dfca3e51d9529ba499017c887d076a9eb9b3)
\
 N -- N -- N (770cbc68a48b233fed001a580a12e1f414991095)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.php.net/?p=karma.git;a=log;h=770cbc68a48b233fed001a580a12e1f414991095;hp=5f74dfca3e51d9529ba499017c887d076a9eb9b3

Summary of changes:
 hooks/post-receive.mirror |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- Log 
commit 770cbc68a48b233fed001a580a12e1f414991095
Author: David Soria Parra d...@php.net
Date:   Tue Jan 24 13:15:27 2012 +0100

Calculate pathes based on the repodir

diff --git a/hooks/post-receive.mirror b/hooks/post-receive.mirror
index 450da6a..dcb2d9c 100755
--- a/hooks/post-receive.mirror
+++ b/hooks/post-receive.mirror
@@ -13,10 +13,7 @@ echo Attempting to push to mirror
 
 if $(echo $target | grep -q REPO);
 then
-#  if [ -z $GL_REPO ];
-#  then
-   GL_REPO=$(pwd | perl -e ' =~ /([^\/]+)\.git$/; print $1;');
-#fi
+   GL_REPO=$(pwd | perl -e ' =~ /\/git\/repositories\/(.*?)\.git$/; 
print $1;';)
# Support a REPO variable for wildcard mirrors
target=$(echo $target | sed -e s,REPO,$GL_REPO,g)
 fi

Thank you for your contribution.

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



[PHP-CVS] [git] karma.git branch master updated. 7099d17

2012-01-24 Thread dsp
The branch, master on karma.git has been updated
  discards  770cbc68a48b233fed001a580a12e1f414991095 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (770cbc68a48b233fed001a580a12e1f414991095)
\
 N -- N -- N (7099d1791e0aa244b169dc03646d999574b47dd1)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.php.net/?p=karma.git;a=log;h=7099d1791e0aa244b169dc03646d999574b47dd1;hp=770cbc68a48b233fed001a580a12e1f414991095

Summary of changes:
 hooks/post-receive.mirror |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- Log 
commit 7099d1791e0aa244b169dc03646d999574b47dd1
Author: David Soria Parra d...@php.net
Date:   Tue Jan 24 13:15:27 2012 +0100

Calculate pathes based on the repodir

diff --git a/hooks/post-receive.mirror b/hooks/post-receive.mirror
index 450da6a..5a06017 100755
--- a/hooks/post-receive.mirror
+++ b/hooks/post-receive.mirror
@@ -13,10 +13,7 @@ echo Attempting to push to mirror
 
 if $(echo $target | grep -q REPO);
 then
-#  if [ -z $GL_REPO ];
-#  then
-   GL_REPO=$(pwd | perl -e ' =~ /([^\/]+)\.git$/; print $1;');
-#fi
+   GL_REPO=$(pwd | perl -e ' =~ /\/git\/repositories\/(.*?)\.git$/; 
print $1;'; | sed s,/,-,g)
# Support a REPO variable for wildcard mirrors
target=$(echo $target | sed -e s,REPO,$GL_REPO,g)
 fi

Thank you for your contribution.

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



[PHP-CVS] [git] karma.git branch master updated. 7c248f4

2012-01-24 Thread dsp
The branch, master on karma.git has been updated
  discards  7099d1791e0aa244b169dc03646d999574b47dd1 (commit)
   via  7c248f479715e02c72ea74942830b9643651be8c (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (7099d1791e0aa244b169dc03646d999574b47dd1)
\
 N -- N -- N (7c248f479715e02c72ea74942830b9643651be8c)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.php.net/?p=karma.git;a=log;h=7c248f479715e02c72ea74942830b9643651be8c;hp=7099d1791e0aa244b169dc03646d999574b47dd1

Summary of changes:
 hooks/post-receive.mirror |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- Log 
commit 7c248f479715e02c72ea74942830b9643651be8c
Author: David Soria Parra d...@php.net
Date:   Tue Jan 24 13:15:27 2012 +0100

Calculate pathes based on the repodir

diff --git a/hooks/post-receive.mirror b/hooks/post-receive.mirror
index 450da6a..128c584 100755
--- a/hooks/post-receive.mirror
+++ b/hooks/post-receive.mirror
@@ -13,10 +13,7 @@ echo Attempting to push to mirror
 
 if $(echo $target | grep -q REPO);
 then
-#  if [ -z $GL_REPO ];
-#  then
-   GL_REPO=$(pwd | perl -e ' =~ /([^\/]+)\.git$/; print $1;');
-#fi
+   GL_REPO=$(pwd | perl -e ' =~ /\/git\/repositories\/(.*?)\.git$/; 
print $1;' | sed s,/,-,g)
# Support a REPO variable for wildcard mirrors
target=$(echo $target | sed -e s,REPO,$GL_REPO,g)
 fi

Thank you for your contribution.

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



[PHP-CVS] [git] karma.git branch master updated. 8d59532

2012-01-24 Thread dsp
The branch, master on karma.git has been updated
   via  8d595325d65b7de86651483a1705a0ee2a4b4bd5 (commit)
  from  7c248f479715e02c72ea74942830b9643651be8c (commit)

http://git.php.net/?p=karma.git;a=log;h=8d595325d65b7de86651483a1705a0ee2a4b4bd5;hp=7c248f479715e02c72ea74942830b9643651be8c

Summary of changes:
 hooks/post-receive |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

-- Log 
commit 8d595325d65b7de86651483a1705a0ee2a4b4bd5
Author: David Soria Parra d...@php.net
Date:   Tue Jan 24 16:57:41 2012 +0100

Always use a abbrev sha1 and not a described tag

Described tag can confuse people if the tag is really old (e.g. 
web/php.git).
We better always use the abbrev sha1 commit hash.

diff --git a/hooks/post-receive b/hooks/post-receive
index 341a00d..3a45616 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -198,10 +198,7 @@ generate_email()
# Email parameters
# The email subject will contain the best description of the ref
# that we can build from the parameters
-   describe=$(git describe $rev 2/dev/null)
-   if [ -z $describe ]; then
-   describe=$(git rev-parse --short $rev)
-   fi
+   describe=$(git rev-parse --short $rev)
 
generate_email_header
 

Thank you for your contribution.

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



[PHP-CVS] [git] karma.git branch master updated. e8ea9bb51969db576a4a058ff3ab1d8d73433ec6

2012-01-21 Thread dsp
The branch, master on karma.git has been updated
   via  e8ea9bb51969db576a4a058ff3ab1d8d73433ec6 (commit)
   via  96fb9e3bd581610cc5f3e4a2b56374741753d07a (commit)
   via  268135ce2b9dfe64b3153ca133af9e9d82472ee0 (commit)
  from  ee5b0311950d47714cd46a6c63db5d5b97cf28d3 (commit)

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

Summary of changes: 
http://git.php.net/?p=karma.git;a=log;h=e8ea9bb51969db576a4a058ff3ab1d8d73433ec6;hp=ee5b0311950d47714cd46a6c63db5d5b97cf28d3
 hooks/post-receive |   49 +++--
 1 files changed, 27 insertions(+), 22 deletions(-)

-- Log 
commit e8ea9bb51969db576a4a058ff3ab1d8d73433ec6
Author: David Soria Parra d...@php.net
Date:   Sat Jan 21 19:02:01 2012 -0800

Add link to gitweb

diff --git a/hooks/post-receive b/hooks/post-receive
index e9a28c8..c7d5108 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -421,7 +421,9 @@ generate_update_branch_email()
 #  echo not appeared on any other notification email; so we list 
those
 #  echo revisions in full, below.
 
-   echo Summary of changes:
+   echo http://git.php.net/?p=$project;a=log;h=$newrev;hp=$oldrev;
+   echo 
+   echo Summary of changes: 
http://git.php.net/?p=$project;a=log;h=$newrev;hp=$oldrev;
git diff-tree $diffopts $oldrev..$newrev
 
echo 
@@ -707,7 +709,8 @@ if [ -z $GIT_DIR ]; then
 fi
 
 #projectdesc=$(sed -ne '1p' $GIT_DIR/description 2/dev/null)
-projectdesc=$(pwd | sed -e s,/git/repositories/,,g )
+project=$(pwd | sed -e s,/git/repositories/,,g )
+projectdesc=$project
 # Check if the description is unchanged from it's default, and shorten it to
 # a more manageable length if it is
 if expr $projectdesc : Unnamed repository.*$ /dev/null

commit 96fb9e3bd581610cc5f3e4a2b56374741753d07a
Author: David Soria Parra d...@php.net
Date:   Sat Jan 21 17:16:44 2012 -0800

Use different email format

diff --git a/hooks/post-receive b/hooks/post-receive
index 8536bd2..e9a28c8 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -239,11 +239,7 @@ generate_email_header()
X-Git-Oldrev: $oldrev
X-Git-Newrev: $newrev
 
-   This is an automated email from the git hooks/post-receive script. It 
was
-   generated because a ref change was pushed to the repository containing
-   the project $projectdesc.
-
-   The $refname_type, $short_refname has been ${change_type}d
+   The $refname_type, $short_refname on $projectdesc has been 
${change_type}d
EOF
 }
 
@@ -251,11 +247,7 @@ generate_email_footer()
 {
SPACE= 
cat -EOF
-
-
-   hooks/post-receive
-   --${SPACE}
-   $projectdesc
+Thank you for your contribution.
EOF
 }
 
@@ -425,9 +417,12 @@ generate_update_branch_email()
 
echo 
if [ -z $rewind_only ]; then
-   echo Those revisions listed above that are new to this 
repository have
-   echo not appeared on any other notification email; so we list 
those
-   echo revisions in full, below.
+#  echo Those revisions listed above that are new to this 
repository have
+#  echo not appeared on any other notification email; so we list 
those
+#  echo revisions in full, below.
+
+   echo Summary of changes:
+   git diff-tree $diffopts $oldrev..$newrev
 
echo 
echo $LOGBEGIN
@@ -437,7 +432,7 @@ generate_update_branch_email()
# outputted anything, so that we can issue a no new
# revisions added by this update message
 
-   echo $LOGEND
+#  echo $LOGEND
else
echo No new revisions were added by this update.
fi
@@ -449,9 +444,6 @@ generate_update_branch_email()
# point - the user will be interested in what this revision changed
# - including the undoing of previous revisions in the case of
# non-fast-forward updates.
-   echo 
-   echo Summary of changes:
-   git diff-tree $diffopts $oldrev..$newrev
 }
 
 #
@@ -702,8 +694,8 @@ send_mail()
 #  main()
 
 # --- Constants
-LOGBEGIN=- Log 
-
-LOGEND=---
+LOGBEGIN=-- Log 
+LOGEND=
 
 # --- Config
 # Set GIT_DIR either from the working directory, or from the environment
@@ -714,7 +706,8 @@ if [ -z $GIT_DIR ]; then
exit 1
 fi
 
-projectdesc=$(sed -ne '1p' $GIT_DIR/description 2/dev/null)
+#projectdesc=$(sed -ne '1p' $GIT_DIR/description 2/dev/null)
+projectdesc=$(pwd | sed -e s,/git/repositories/,,g )
 # Check if the description is unchanged from it's default, 

[PHP-CVS] [git] karma.git branch master updated. 0f16aa9900ae3360fe65c11a031f08082bae37fa

2012-01-21 Thread dsp
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



[PHP-CVS] [git] karma.git branch master updated. 83c34e4cef80b939ad72870fb5ed8adb1ddf3632

2012-01-21 Thread dsp
The branch, master on karma.git has been updated
  from  0f16aa9900ae3360fe65c11a031f08082bae37fa (commit)
  to83c34e4cef80b939ad72870fb5ed8adb1ddf3632 (commit)

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

Summary of changes: 
http://git.php.net/?p=karma.git;a=log;h=83c34e4cef80b939ad72870fb5ed8adb1ddf3632;hp=0f16aa9900ae3360fe65c11a031f08082bae37fa
 hooks/post-receive |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

-- Log 
commit 83c34e4cef80b939ad72870fb5ed8adb1ddf3632
Author: David Soria Parra d...@php.net
Date:   Sun Jan 22 04:36:57 2012 +0100

Use abbrevated commit hashes in the email header

diff --git a/hooks/post-receive b/hooks/post-receive
index 8c90406..5c3a216 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -200,7 +200,7 @@ generate_email()
# that we can build from the parameters
describe=$(git describe $rev 2/dev/null)
if [ -z $describe ]; then
-   describe=$rev
+   describe=$(git rev-parse --short $rev)
fi
 
generate_email_header

commit 469b8d185c9b990b5ed6cf1e2da7316f469d3874
Author: David Soria Parra d...@php.net
Date:   Sun Jan 22 04:33:06 2012 +0100

Do not complain about missing config variable

If we do not have a hook.* variable set we just don't send the mail, that's 
it.
No reason to complain.

diff --git a/hooks/post-receive b/hooks/post-receive
index b86edb3..8c90406 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -169,8 +169,6 @@ prep_for_email()
config_name=hooks.mailinglist
;;
esac
-   echo 2 *** $config_name is not set so no email will be sent
-   echo 2 *** for $refname update $oldrev-$newrev
return 1
fi
 

commit e8292a5d4432df5ffd8a9e92ca2776f5a17b44d5
Author: David Soria Parra d...@php.net
Date:   Sun Jan 22 04:31:48 2012 +0100

Only notify user that we are sending mails when we have recipients

diff --git a/hooks/post-receive b/hooks/post-receive
index c7d5108..b86edb3 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -736,7 +736,7 @@ maxlines=$(git config hooks.emailmaxlines)
 diffopts=$(git config hooks.diffopts)
 : ${diffopts:=--stat --summary --find-copies-harder}
 
-echo Sending notifications to $recipients.
+[ -n $recipients ]  echo Sending notifications to $recipients.
 
 # --- Main loop
 # Allow dual mode: run from the command line just like the update hook, or

Thank you for your contribution.

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



[PHP-CVS] [git] karma.git branch master updated. e02dd3d

2012-01-21 Thread dsp
The branch, master on karma.git has been updated
  from  83c34e4cef80b939ad72870fb5ed8adb1ddf3632 (commit)
  toe02dd3d1130c6c5a08bd255a0d97f8d26d27380a (commit)

http://git.php.net/?p=karma.git;a=log;h=e02dd3d1130c6c5a08bd255a0d97f8d26d27380a;hp=83c34e4cef80b939ad72870fb5ed8adb1ddf3632

Summary of changes: 
http://git.php.net/?p=karma.git;a=log;h=e02dd3d1130c6c5a08bd255a0d97f8d26d27380a;hp=83c34e4cef80b939ad72870fb5ed8adb1ddf3632
 hooks/post-receive |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

-- Log 
commit e02dd3d1130c6c5a08bd255a0d97f8d26d27380a
Author: David Soria Parra d...@php.net
Date:   Sun Jan 22 04:39:12 2012 +0100

Only display gitweb url once

diff --git a/hooks/post-receive b/hooks/post-receive
index 5c3a216..341a00d 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -421,7 +421,7 @@ generate_update_branch_email()
 
echo http://git.php.net/?p=$project;a=log;h=$newrev;hp=$oldrev;
echo 
-   echo Summary of changes: 
http://git.php.net/?p=$project;a=log;h=$newrev;hp=$oldrev;
+   echo Summary of changes:
git diff-tree $diffopts $oldrev..$newrev
 
echo 

Thank you for your contribution.

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