Skip to content

Commit 60a7dab

Browse files
committed
MC-37324: Add fallback to 'patch' command when 'git' command is not available
- Remove dead code
1 parent ff40569 commit 60a7dab

File tree

2 files changed

+0
-175
lines changed

2 files changed

+0
-175
lines changed

src/Shell/Command/DriverException.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,10 @@
88
namespace Magento\CloudPatches\Shell\Command;
99

1010
use Magento\CloudPatches\Patch\PatchCommandException;
11-
use Throwable;
1211

1312
/**
1413
* Patch command driver exception
1514
*/
1615
class DriverException extends PatchCommandException
1716
{
18-
/**
19-
* @param string $message
20-
* @param int $code
21-
* @param Throwable|null $previous
22-
*/
23-
public function __construct(string $message, int $code = 0, Throwable $previous = null)
24-
{
25-
parent::__construct($this->formatMessage($message), $code, $previous);
26-
}
27-
28-
/**
29-
* Format error message
30-
*
31-
* @param string $message
32-
* @return string
33-
*/
34-
private function formatMessage(string $message): string
35-
{
36-
$result = $message;
37-
$errorMsg = null;
38-
$generalMsg = null;
39-
if (preg_match('#^.*?Error Output:(?<errors>.*?)$#is', $result, $matches)) {
40-
$errorMsg = 'Error Output:' . $matches['errors'];
41-
$result = str_replace($errorMsg, '', $result);
42-
if (!trim(str_replace('=', '', $matches['errors']))) {
43-
$errorMsg = null;
44-
}
45-
}
46-
if (empty($errorMsg) && preg_match('#^.*?Output:(?<errors>.*?)$#is', $result, $matches)) {
47-
$generalMsg = 'Output:' . $matches['errors'];
48-
if (!trim(str_replace('=', '', $matches['errors']))) {
49-
$generalMsg = null;
50-
}
51-
}
52-
53-
return $errorMsg ?? $generalMsg ?? $message;
54-
}
5517
}

src/Test/Unit/Shell/Command/DriverExceptionTest.php

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)