[git] commit karma.git: lib/Git/PostReceiveHook.php
| From: | Derick Rethans | Date: | Tue, 20 Mar 2012 08:42:52 +0000 |
| Subject: | [git] commit karma.git: lib/Git/PostReceiveHook.php | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-68031@lists.php.net to get a copy of this message | ||
Commit: 3bacfbd956538305c8f604271071d839ecb1f559
Author: Derick Rethans(github@derickrethans.nl) Tue, 20 Mar 2012 08:25:38 +0000
Committer: Derick Rethans(github@derickrethans.nl) Tue, 20 Mar 2012 08:25:38 +0000
Parents: bdcf0e849a28c2b06017f225dd488bd26366bf88 11bc19461cfada676edd5852edc529532ef7a3ac
Link: http://git.php.net/?p=karma.git;a=commitdiff;h=3bacfbd956538305c8f604271071d839ecb1f559
Log:
Merge branch 'master' of git.php.net:/karma
Changed paths:
MM lib/Git/PostReceiveHook.php
Diff:
3bacfbd956538305c8f604271071d839ecb1f559
diff --combined lib/Git/PostReceiveHook.php
index b05feca,ee3aab7..4201508
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@@ -39,70 -39,6 +39,6 @@@ class PostReceiveHook extends ReceiveHo
$this->allBranches = $this->getAllBranches();
}
-
- public function getReceivedMessages()
- {
- $this->hookInput();
-
- $paths = array_map(
- function ($input) {
- return $this->getReceivedMessagesForRange($input['old'],
$input['new']);
- },
- $this->refs);
-
- /* remove empty lines, and flattern the array */
- $flattend = array_reduce($paths, 'array_merge', []);
- $paths = array_filter($flattend);
-
- return array_unique($paths);
- }
-
- /**
- * Returns an array of commit messages between revision $old and $new.
- *
- * @param string $old The old revison number.
- * @parma string $new The new revison umber.
- *
- * @return array
- */
- private function getReceivedMessagesForRange($old, $new)
- {
- $repourl = \Git::getRepositoryPath();
- $output = [];
-
- if ($old == '0000000000000000000000000000000000000000') {
- $cmd = sprintf(
- "%s --git-dir=%s for-each-ref --format='%%(refname)'
'refs/heads/*'",
- self::GIT_EXECUTABLE,
- $repourl
- );
- exec($cmd, $output);
-
- /* do we have heads? otherwise it's a new repo! */
- $heads = implode(' ', $output);
- $not = count($output) > 0 ? sprintf('--not %s', escapeshellarg($heads))
: '';
- $cmd = sprintf(
- '%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s %s',
- \Git::GIT_EXECUTABLE,
- $repourl,
- $not,
- escapeshellarg($new)
- );
- exec($cmd, $output);
- } else {
- $cmd = sprintf(
- '%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s..%s',
- \Git::GIT_EXECUTABLE,
- $repourl,
- escapeshellarg($old),
- escapeshellarg($new)
- );
- exec($cmd, $output);
- }
-
- return $output;
- }
-
/**
* Find user name by nickname in users data file
* @param string $user user nickname
@@@ -225,11 -161,8 +161,8 @@@
}
}
-
-
-
$mail = new \Mail();
- $mail->setSubject($this->emailPrefix . ' branch ' .
$this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' .
$shortname);
+ $mail->setSubject($this->emailPrefix . 'branch ' .
$this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' .
$shortname);
$message = 'Branch ' . $shortname . ' in ' .
$this->getRepositoryName() . ' was ' . $status[$changeType] . 'd' .
"\n";
$message .= 'Date: ' . date('r') . "\n";
@@@ -567,7 -500,7 +500,7 @@@
$diff = \Git::gitExec('diff-tree -c -p %s', escapeshellarg($revision));
$mail = new \Mail();
- $mail->setSubject($this->emailPrefix . ' commit ' .
$this->getRepositoryName() . ': ' . implode(' ', array_keys($paths)));
+ $mail->setSubject($this->emailPrefix . 'com ' .
$this->getRepositoryName() . ': ' . $info['subject'] . ': '.
implode(' ', array_keys($paths)));
$message = '';
@@@ -585,7 -518,9 +518,9 @@@
}
- if (strlen($pathsString) < 8192) {
+ if ($pathsString == '') {
+ $message .= "\nTrivial merge\n";
+ } elseif (strlen($pathsString) < 8192) {
// inline changed paths
$message .= "\nChanged paths:\n" . $pathsString . "\n";
if ((strlen($pathsString) + strlen($diff)) < 8192) {