• Manuel Grizonnet's avatar
    ENH: Remove double underscore in header guards (.txx & __otb*_h form) · 82842d15
    Manuel Grizonnet authored
    Used the following command:
    
    find . \( -iname *.txx -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/__otb(.*)_txx/otb$1_txx/g;' {} \;
    find . \( -iname *.h -and ! -path *ThirdParty* \) -exec perl -pi -w -e 's/__otb(.*)_h/otb$1_h/g;' {} \;
    
    Fixes many, but not all, clang -Wreserved-id-macro warnings.
    82842d15
GitRepository.php 1.34 KiB
<?php declare(strict_types=1);
/*
 * irstea/php-cs-fixer-config - Jeux de règles pour php-cs-fixer.
 * Copyright (C) 2018-2019 IRSTEA
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Irstea\CS\Git;
use Assert\Assertion;
/**
 * Class GitRepository.
final class GitRepository implements GitRepositoryInterface
    /**
     * @var string
    private $repositoryPath;
    /**
     * GitRepository constructor.
     * @param string $repositoryPath
    public function __construct($repositoryPath)
        Assertion::string($repositoryPath);
        Assertion::directory($repositoryPath . '/.git');
        $this->repositoryPath = $repositoryPath;
    /**
     * {@inheritdoc}
    public function getHeadCommit()
        return trim(shell_exec('git -C ' . escapeshellarg($this->repositoryPath) . ' rev-parse HEAD'));
    /**
     * {@inheritdoc}
    public function getYearRange()
        $last = date('Y');
        $first = exec('git -C ' . escapeshellarg($this->repositoryPath) . ' log --format=%cd --date=format:%Y --date-order | tail -n1');
        if (!$first) {
            $first = '???';
        return ($last !== null && $last !== $first) ? "$first-$last" : $first;