1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of CaptainHook. |
4
|
|
|
* |
5
|
|
|
* (c) Sebastian Feldmann <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
namespace CaptainHook\App\Console\Command\Hook; |
11
|
|
|
|
12
|
|
|
use CaptainHook\App\Config; |
13
|
|
|
use CaptainHook\App\Console\Command\Hook; |
14
|
|
|
use CaptainHook\App\Hooks; |
15
|
|
|
use SebastianFeldmann\Git; |
16
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class PrepareCommitMessage |
22
|
|
|
* |
23
|
|
|
* @package CaptainHook |
24
|
|
|
* @author Sebastian Feldmann <[email protected]> |
25
|
|
|
* @link https://github.com/sebastianfeldmann/captainhook |
26
|
|
|
* @since Class available since Release 3.0.1 |
27
|
|
|
*/ |
28
|
|
|
class PrepareCommitMsg extends Hook |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* Hook to execute |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
protected $hookName = Hooks::PREPARE_COMMIT_MSG; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Configure the command. |
39
|
|
|
*/ |
40
|
1 |
|
protected function configure() |
41
|
|
|
{ |
42
|
1 |
|
parent::configure(); |
43
|
1 |
|
$this->addArgument('file', InputArgument::REQUIRED, 'File containing the commit log message'); |
44
|
1 |
|
$this->addArgument('mode', InputArgument::OPTIONAL, 'Current commit mode'); |
45
|
1 |
|
$this->addArgument('hash', InputArgument::OPTIONAL, 'Given commit hash'); |
46
|
1 |
|
} |
47
|
|
|
/** |
48
|
|
|
* Read the commit message from file. |
49
|
|
|
* |
50
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
51
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
52
|
|
|
* @param \CaptainHook\App\Config $config |
53
|
|
|
* @param \SebastianFeldmann\Git\Repository $repository |
54
|
|
|
*/ |
55
|
1 |
|
protected function setup(InputInterface $input, OutputInterface $output, Config $config, Git\Repository $repository) |
56
|
|
|
{ |
57
|
|
|
// TODO: the message preparation settings have to be stored in the repository object |
58
|
1 |
|
} |
59
|
|
|
} |
60
|
|
|
|