Skip to content

Commit 2b8b7a9

Browse files
authored
Gitweb: find parent commits with pathinfo URLs
The current RegEx string only works when Gitweb is creating the links on the page with 'standard' URLs. Modify RegEx to support finding parent commit ID when GitWeb is using pathinfo-formatted URLs [1]. Fixes #418 [1]: https://git-scm.com/docs/gitweb#_path_info_usage Signed-off-by: Damien Regad <[email protected]>
1 parent 5fc3b81 commit 2b8b7a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SourceGitweb/SourceGitweb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
355355
$t_commit['message'] = trim( str_replace( '<br/>', PHP_EOL, $t_matches[6] ) );
356356

357357
$t_parents = array();
358-
if ( preg_match_all( '#parent</td><td class="sha1"><[^>]*h=([0-9a-f]*)#', $t_gitweb_data, $t_matches ) ) {
358+
if ( preg_match_all( '#parent</td><td class="sha1"><[^>]*(?:h=|/commit/)([0-9a-f]*)#', $t_gitweb_data, $t_matches ) ) {
359359
foreach( $t_matches[1] as $t_match ) {
360360
$t_parents[] = $t_commit['parent'] = $t_match;
361361
}

0 commit comments

Comments
 (0)