Skip to content

Commit 1bbb0be

Browse files
committed
Clarify indentation logic
1 parent d371d6a commit 1bbb0be

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

merge.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// are we working with the lock file?
1717
$isLock = strtolower($argv[5]) === 'composer.lock';
1818
// indentation type to use
19-
$indentation = ' ';
19+
$indentation = $defaultIndentation = ' ';
2020

2121
// grab the contents of each file state
2222
foreach ($states as $i => $state) {
@@ -182,8 +182,8 @@ function merge($ancestor, $ours, $theirs) {
182182
}, $merged);
183183

184184
// fix the indentation per the user's preference, except for the lock
185-
if (!$isLock && $indentation !== ' ') {
186-
$merged = preg_replace_callback('/^(?: {4})+/m', function($matches) use ($indentation) {
185+
if (!$isLock && $indentation !== $defaultIndentation) {
186+
$merged = preg_replace_callback("/^(?:{$defaultIndentation})+/m", function($matches) use ($indentation) {
187187
return str_repeat($indentation, strlen($matches[0]) / 4);
188188
}, $merged);
189189
}

0 commit comments

Comments
 (0)