src/Shell/MailmapShell.php
public function generate($path = null) {
		$path = $this->getPath($path);

		$this->out('Reading ' . $path . '.mailmap');

		$existingMap = $this->parseMailmap($path);

		$this->out('Found ' . count($this->map) . ' existing entries in .mailmap file');

		$rows = $this->parseHistory($path, $existingMap);

		$array = [];
		foreach ($rows as $row) {
			$key = strtolower($row['email']);

			$array[$key][] = $row;
		}

		$map = $this->map;

		foreach ($array as $elements) {
			if (count($elements) < 2) {
				continue;
			}

			$primary = array_shift($elements);
			$map[] = $primary['content'];
			foreach ($elements as $element) {
				$map[] = $primary['content'] . ' ' . $element['content'];
			}
		}

		$file = $path . '.mailmap';
		if ($this->params['dry-run']) {
			$file = TMP . '.mailmap';
		}

		file_put_contents($file, implode(PHP_EOL, $map));
		$this->out((count($map) - count($this->map)) . ' additional rows written to ' . $file);
	}
public function generate($path = null) {
		$path = $this->getPath($path);

		$this->out('Reading ' . $path . '.mailmap');

		$existingMap = $this->parseMailmap($path);

		$this->out('Found ' . count($this->map) . ' existing entries in .mailmap file');

		$rows = $this->parseHistory($path, $existingMap);

		$array = [];
		foreach ($rows as $row) {
			$key = strtolower($row['email']);

			$array[$key][] = $row;
		}

		$map = $this->map;

		foreach ($array as $elements) {
			if (count($elements) < 2) {
				continue;
			}

			$primary = array_shift($elements);
			$map[] = $primary['content'];
			foreach ($elements as $element) {
				$map[] = $primary['content'] . ' ' . $element['content'];
			}
		}

		$file = $path . '.mailmap';
		if ($this->params['dry-run']) {
			$file = TMP . '.mailmap';
		}

		file_put_contents($file, implode(PHP_EOL, $map));
		$this->out((count($map) - count($this->map)) . ' additional rows written to ' . $file);
	}
public function generate ( $ path = null ) { $ path = $ this -> getPath ( $ path ) ; $ this -> out ( 'Reading ' . $ path . '.mailmap' ) ; $ existingMap = $ this -> parseMailmap ( $ path ) ; $ this -> out ( 'Found ' . count ( $ this -> map ) . ' existing entries in .mailmap file' ) ; $ rows = $ this -> parseHistory ( $ path , $ existingMap ) ; $ array = [ ] ; foreach ( $ rows as $ row ) { $ key = strtolower ( $ row [ 'email' ] ) ; $ array [ $ key ] [ ] = $ row ; } $ map = $ this -> map ; foreach ( $ array as $ elements ) { if ( count ( $ elements ) < 2 ) { continue ; } $ primary = array_shift ( $ elements ) ; $ map [ ] = $ primary [ 'content' ] ; foreach ( $ elements as $ element ) { $ map [ ] = $ primary [ 'content' ] . ' ' . $ element [ 'content' ] ; } } $ file = $ path . '.mailmap' ; if ( $ this -> params [ 'dry-run' ] ) { $ file = TMP . '.mailmap' ; } file_put_contents ( $ file , implode ( PHP_EOL , $ map ) ) ; $ this -> out ( ( count ( $ map ) - count ( $ this -> map ) ) . ' additional rows written to ' . $ file ) ; }
Generates .mailmap file.

@param string|null $path
@return void
Generates . mailmap file .