diff --git a/SourceGitweb/SourceGitweb.php b/SourceGitweb/SourceGitweb.php index eeb7ec27b..6c20d0809 100644 --- a/SourceGitweb/SourceGitweb.php +++ b/SourceGitweb/SourceGitweb.php @@ -117,17 +117,21 @@ public function precommit( ) { } public function commit( $p_repo, $p_data ) { + # Handle branch names with '+' character + $p_data = str_replace('_plus_', '+', $p_data); + # The -d option from curl requires you to encode your own data. # Once it reaches here it is decoded. Hence we split by a space # were as the curl command uses a '+' character instead. # i.e. DATA=`echo $INPUT | sed -e 's/ /+/g'` list ( , $t_commit_id, $t_branch) = explode(' ', $p_data); - list ( , , $t_branch) = explode('/', $t_branch); + list ( , , $t_branch) = explode('/', $t_branch, 3); + # master_branch contains comma-separated list of branches $t_branches = explode(',', $p_repo->info['master_branch']); - if (!in_array($t_branch, $t_branches)) + if (!in_array('*', $t_branches) and !in_array($t_branch, $t_branches)) { - return; + return; } return $this->import_commits($p_repo, null, $t_commit_id, $t_branch); @@ -218,11 +222,14 @@ private function import_commits( $p_repo, $p_uri_base, $p_commit_ids, $p_branch= echo "Retrieving $t_commit_id ... "; - $t_commit_url = $this->uri_base( $p_repo ) . 'a=commit;h=' . $t_commit_id; + # Handle branch names with '+' character + $t_fixed_id = str_replace('+', '%2B', $t_commit_id); + $t_commit_url = $this->uri_base( $p_repo ) . 'a=commit;h=' . $t_fixed_id; $t_input = url_get( $t_commit_url ); if ( false === $t_input ) { echo "failed.\n"; + echo "$t_commit_url\n"; # DEBUG continue; } @@ -232,6 +239,7 @@ private function import_commits( $p_repo, $p_uri_base, $p_commit_ids, $p_branch= } $s_parents = array_merge( $s_parents, $t_commit_parents ); + $s_counter += 1; } $s_counter = 0; @@ -274,37 +282,34 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) { if ( !SourceChangeset::exists( $p_repo->id, $t_commit['revision'] ) ) { # Parse for commit data - preg_match( '#