diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php index 6c799dfb47..3cbcc02708 100644 --- a/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php +++ b/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php @@ -275,6 +275,7 @@ public function approved_create_svn_repo( $post, $plugin_author = null ) { $dir, 'http://plugins.svn.wordpress.org/' . $post->post_name, sprintf( + // WARNING: When changing this, please update the regex in SVN_Watcher::get_plugin_changes_between(). 'Adding %1$s by %2$s.', html_entity_decode( $post->post_title ), $plugin_author->user_login diff --git a/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php b/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php index b71e59c70f..ec7224176f 100644 --- a/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php +++ b/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php @@ -66,7 +66,6 @@ public function watch() { * @return array A list of plugin changes to process. */ protected function get_plugin_changes_between( $rev, $head_rev = 'HEAD' ) { - $logs = SVN::log( self::SVN_URL, array( $rev, $head_rev ) ); if ( $logs['errors'] ) { if ( wp_cache_get( 'get_plugin_changes_between_failed', 'svn-watch' ) ) { @@ -94,9 +93,27 @@ protected function get_plugin_changes_between( $rev, $head_rev = 'HEAD' ) { $plugins = array(); foreach ( $logs['log'] as $log ) { - // Discard automated changes, these should not trigger plugin imports - if ( defined( 'PLUGIN_SVN_MANAGEMENT_USER' ) && PLUGIN_SVN_MANAGEMENT_USER == $log['author'] ) { - continue; + // Discard some commits from the plugin management user. + if ( + defined( 'PLUGIN_SVN_MANAGEMENT_USER' ) && + PLUGIN_SVN_MANAGEMENT_USER == $log['author'] + ) { + /* + * If the commit matches the "new repo created" message, we'll skip it. + * + * See Status_Transitions::approved_create_svn_repo() + */ + if ( preg_match( '/^Adding (.+) by (.+)\.$/i', $log['msg'] ) ) { + continue; + } + + /* + * If the commit includes an "Author:" byline, we'll use that as the actual author. + * This can be used for automated commits that are made on behalf of a user. + */ + if ( preg_match( '/^Author: (.+)\.$/im', $log['msg'], $matches ) ) { + $log['author'] = $matches[1]; + } } $plugin_slug = explode( '/', $log['paths'][0] )[1];