]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check the mailmap file of core as well
authorJoas Schilling <nickvergessen@owncloud.com>
Fri, 12 Feb 2016 08:06:07 +0000 (09:06 +0100)
committerJoas Schilling <nickvergessen@owncloud.com>
Wed, 17 Feb 2016 07:47:25 +0000 (08:47 +0100)
build/license.php

index 9a2495683c27e29d543bd80627db20cd01244db2..d7ac4e0a143ac7f68974195e2a5841c74b2cbf7e 100644 (file)
@@ -20,7 +20,8 @@
  */
 class Licenses
 {
-       protected $paths = array();
+       protected $paths = [];
+       protected $mailMap = [];
        public $authors = [];
 
        public function __construct() {
@@ -196,12 +197,38 @@ With help from many libraries and frameworks including:
                                'Not Committed Yet <not.committed.yet>',
                                'Jenkins for ownCloud <owncloud-bot@tmit.eu>']);
                });
+
+               if ($gitRoot) {
+                       $authors = array_map([$this, 'checkCoreMailMap'], $authors);
+                       $authors = array_unique($authors);
+               }
+
                $authors = array_map(function($author){
                        $this->authors[$author] = $author;
                        return " * @author $author";
                }, $authors);
                return implode(PHP_EOL, $authors);
        }
+
+       private function checkCoreMailMap($author) {
+               if (empty($this->mailMap)) {
+                       $content = file_get_contents(__DIR__ . '/../.mailmap');
+                       $entries = explode("\n", $content);
+                       foreach ($entries as $entry) {
+                               if (strpos($entry, '> ') === false) {
+                                       $this->mailMap[$entry] = $entry;
+                               } else {
+                                       list($use, $actual) = explode('> ', $entry);
+                                       $this->mailMap[$actual] = $use . '>';
+                               }
+                       }
+               }
+
+               if (isset($this->mailMap[$author])) {
+                       return $this->mailMap[$author];
+               }
+               return $author;
+       }
 }
 
 $licenses = new Licenses;