Skip to content

Commit

Permalink
fix: can generate changelog on tag is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 11, 2021
1 parent 7346fcd commit bf9d5a6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/Console/Controller/GitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function branchCommand(FlagsParser $fs, Output $output): void
$name = substr($name, $rmtLen);
}

if ($keyword && strpos($name, $keyword) === false) {
if ($keyword && !str_contains($name, $keyword)) {
continue;
}

Expand Down Expand Up @@ -857,7 +857,10 @@ public function changelogCommand(FlagsParser $fs, Output $output): void
}

$output->info('collect git log output');
$builder->add("$oldVersion...$newVersion");
if ($oldVersion && $newVersion) {
$builder->add("$oldVersion...$newVersion");
}

$builder->addf('--pretty=format:"%s"', $logFmt);

// $b->addIf("--exclude $exclude", $exclude);
Expand All @@ -869,9 +872,8 @@ public function changelogCommand(FlagsParser $fs, Output $output): void

$repoUrl = $fs->getOpt('repo-url');
if (!$repoUrl) {
$info = $repo->getRemoteInfo();

$repoUrl = $info->getHttpUrl();
$rmtInfo = $repo->getRemoteInfo();
$repoUrl = $rmtInfo->getHttpUrl();
}

$output->info('repo URL: ' . $repoUrl);
Expand Down Expand Up @@ -940,9 +942,9 @@ protected function getLogVersion(string $version): string
}

/**
* @var TagsInfo
* @var TagsInfo|null
*/
private $tagsInfo;
private ?TagsInfo $tagsInfo = null;

/**
* @return TagsInfo
Expand Down

0 comments on commit bf9d5a6

Please sign in to comment.