Commit f1490f08 authored by drumm's avatar drumm
Browse files

Issue #3300663: Handle major-only dev branches, like “1.x” when finding dev commit counts

parent e218bc0c
......@@ -208,10 +208,16 @@ class DrupalorgProjectPackageRelease implements ProjectReleasePackagerInterface
drush_shell_cd_and_exec($this->git_checkout_dir, "git describe --tags %s 2>&1", $last_tag_hash[0]);
if ($last_tag = drush_shell_exec_output()) {
// Make sure the tag starts as Drupal formatted (for eg.
// 7.x-1.0-alpha1) and if we are on a proper branch (ie. not master)
// then it's on that branch.
// 7.x-1.0-alpha1 or 1.0.0) and if we are on a release branch then
// it’s on that branch.
$version_regex = preg_quote(substr($this->git_label, 0, -1), '/');
if (preg_match('/^\d+\.x$/', $this->git_label)) {
// Major-only semantic versions branch, like 1.x or 2.x. The tagged
// releases will have an additional minor version component.
$version_regex .= '\d+\.';
}
$matches = [];
if (preg_match('/^(?<drupalversion>' . preg_quote(substr($this->git_label, 0, -1)) . '\d+(?:-[^-]+)?)(?<gitextra>-(?<numberofcommits>\d+-)g[0-9a-f]{7})?$/', $last_tag[0], $matches)) {
if (preg_match('/^(?<drupalversion>' . $version_regex . '\d+(?:-[^-]+)?)(?<gitextra>-(?<numberofcommits>\d+-)g[0-9a-f]{7})?$/', $last_tag[0], $matches)) {
// If we found additional git metadata (in particular, number of
// commits) then use that info to build the version string.
if (isset($matches['gitextra'])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment