Skip to content

Commit

Permalink
merged in forward-ports from release/3.X
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Paiste committed Aug 16, 2018
2 parents 792cd02 + 3006911 commit 17b0e97
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
17 changes: 17 additions & 0 deletions changelog.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"DEV.4.X.X": [
],
"4.1.1": {
"fix": [
"forward-port(3.32.1): definition list validation command returning with false failures when using #skip on patch paths"
],
"maintenance": [
"forward-port(3.32.1): removing #skip flag from path when encountered (previously it remained in the path)"
]
},
"4.1.0": {
"feature": [
"forward-port(3.32.0): allow comments on any level and with any keyword as long as it starts with underscore (_)"
Expand All @@ -20,6 +28,15 @@
"allow patch failures to be passed over gracefully with extra/patcher/graceful configuration in root package"
]
},
"3.32.1": {
"fix": [
"definition list validation command returning with false failures when using #skip on patch paths"
],
"maintenance": [
"removing #skip flag from path when encountered (previously it remained in the path)"
],
"branch": "release/3.X"
},
"3.32.0": {
"feature": [
"allow comments on any level and with any keyword as long as it starts with underscore (_)"
Expand Down
7 changes: 5 additions & 2 deletions src/Composer/Commands/ValidateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ protected function execute(InputInterface $input, OutputInterface $output)

$config = $configFactory->create(array($config));

$loaderComponentsPool->registerComponent('constraints', false);
$loaderComponentsPool->registerComponent('targets-resolver', false);
$skippedComponents = array('constraints', 'targets-resolver', 'local-exclude', 'global-exclude');

foreach ($skippedComponents as $componentName) {
$loaderComponentsPool->registerComponent($componentName, false);
}

$patchesLoader = $loaderFactory->create($loaderComponentsPool, $config, true);

Expand Down
17 changes: 9 additions & 8 deletions src/Patch/Definition/NormalizerComponents/SkipComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ class SkipComponent implements \Vaimo\ComposerPatches\Interfaces\DefinitionNorma
public function normalize($target, $label, array $data, array $ownerConfig)
{
$source = $data[PatchDefinition::SOURCE];
$flag = '#' . PatchDefinition::SKIP;

$sourceSegments = explode('#', $source);
$lastSegment = array_pop($sourceSegments);

if ($lastSegment === PatchDefinition::SKIP) {
$data[PatchDefinition::SKIP] = true;
if (strstr($source, $flag) !== $flag) {
return array(
PatchDefinition::SKIP => isset($data[PatchDefinition::SKIP])
? $data[PatchDefinition::SKIP]
: false
);
}

return array(
PatchDefinition::SKIP => isset($data[PatchDefinition::SKIP])
? $data[PatchDefinition::SKIP]
: false
PatchDefinition::SOURCE => substr($source, 0, strrpos($source, $flag)),
PatchDefinition::SKIP => true
);
}
}

0 comments on commit 17b0e97

Please sign in to comment.