Making WordPress.org

Changeset 10037


Ignore:
Timestamp:
07/08/2020 05:41:19 PM (4 years ago)
Author:
ryelle
Message:

Plugin Directory: Add github branch support to the block validator

See #5303

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-block-plugin-checker.php

    r10035 r10037  
    136136            // git@github.com:sortabrilliant/jumbotron.git
    137137            // https://github.com/sortabrilliant/jumbotron.git
    138             //
    139             if ( preg_match( '#^/(\w+/[^.]+)(?:\.git)?$#', $url_parts[ 'path' ], $matches ) ) {
    140                 $url = 'https://github.com/' . $matches[1] . '.git/trunk';
     138            if ( preg_match( '#^/(\w+/[^./]+)(?:\.git)?(.*)$#', $url_parts['path'], $matches ) ) {
     139                if ( empty( $matches[2] ) ) {
     140                    $url = 'https://github.com/' . $matches[1] . '.git/trunk';
     141                } else {
     142                    $branch = str_replace( '/tree/', '/branches/', $matches[2] );
     143                    $url = 'https://github.com/' . $matches[1] . '.git' . $branch;
     144                }
    141145            } else {
    142146                $this->record_result(
Note: See TracChangeset for help on using the changeset viewer.