Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,13 @@ public function generate(string $root, InputInterface $input, SymfonyStyle $outp
$previousTag = $toTag;
}
if ($autoCommit) {
// Use firstCommit if lastVersion is the default '0.0.0' (no tags found)
$fromRevision = ($lastVersion === '0.0.0') ? $firstCommit : $lastVersion;
$options[$newVersion] = [
'from' => $lastVersion,
'to' => $newVersion,
'date' => $today->format($dateFormat),
'options' => "{$lastVersion}...HEAD",
'options' => "{$fromRevision}...HEAD",
'autoBump' => false,
];
}
Expand All @@ -209,7 +211,9 @@ public function generate(string $root, InputInterface $input, SymfonyStyle $outp
}
} else {
// Get latest commits from last version date
$additionalParams = "{$lastVersion}...HEAD";
// Use firstCommit if lastVersion is the default '0.0.0' (no tags found)
$fromRevision = ($lastVersion === '0.0.0') ? $firstCommit : $lastVersion;
$additionalParams = "{$fromRevision}...HEAD";
if (empty($fromTag)) {
$fromTag = $lastVersion;
}
Expand All @@ -228,7 +232,9 @@ public function generate(string $root, InputInterface $input, SymfonyStyle $outp
if (empty($toTag)) {
$toTag = 'HEAD';
}
$additionalParams = "{$fromTag}...{$toTag}";
// Use firstCommit if fromTag is the default '0.0.0' (no tags found)
$fromRevision = ($fromTag === '0.0.0') ? $firstCommit : $fromTag;
$additionalParams = "{$fromRevision}...{$toTag}";
}

// Date range
Expand Down