diff --git a/.gitignore b/.gitignore index 1377554..207784c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.swp +._* +.DS_Store diff --git a/SourceGithub/SourceGithub.php b/SourceGithub/SourceGithub.php index 5261d5c..481a984 100644 --- a/SourceGithub/SourceGithub.php +++ b/SourceGithub/SourceGithub.php @@ -138,7 +138,7 @@ $f_hub_api_token = gpc_get_string( 'hub_api_token' ); $f_master_branch = gpc_get_string( 'master_branch' ); - if ( !preg_match( '/^[a-zA-Z0-9_\., -]*$/', $f_master_branch ) ) { + if ( !preg_match( '/\*|^[a-zA-Z0-9_\., -]*$/', $f_master_branch ) ) { echo 'Invalid parameter: \'Primary Branch\''; trigger_error( ERROR_GENERIC, ERROR ); } @@ -224,7 +224,25 @@ $t_branch = 'master'; } - $t_branches = array_map( 'trim', explode( ',', $t_branch ) ); + if ($t_branch != '*') + { + $t_branches = map( 'trim', explode( ',', $t_branch ) ); + } + else + { + + $t_username = $p_repo->info['hub_username']; + $t_reponame = $p_repo->info['hub_reponame']; + + $t_uri = $this->api_uri( $p_repo, "repos/show/{$t_username}/{$t_reponame}/branches" ); + $t_json = json_url( $t_uri, 'branches' ); + + $t_branches = array(); + foreach (array_keys(get_object_vars($t_json)) as $t_branch) + { + $t_branches[] = $t_branch; + } + } $t_changesets = array(); $t_changeset_table = plugin_table( 'changeset', 'Source' ); diff --git a/SourceGitweb/SourceGitweb.php b/SourceGitweb/SourceGitweb.php index ccfd5f6..ea74280 100644 --- a/SourceGitweb/SourceGitweb.php +++ b/SourceGitweb/SourceGitweb.php @@ -138,10 +138,36 @@ if ( is_blank( $t_branch ) ) { $t_branch = 'master'; } + + if ($t_branch != '*') + { + $t_branches = map( 'trim', explode( ',', $t_branch ) ); + } + else + { + $t_heads_url = $this->uri_base( $p_repo ) . 'a=heads'; + $t_branches_input = url_get( $t_heads_url ); + + $t_branches_input = str_replace( array(PHP_EOL, '<', '>', ' '), array('', '<', '>', ' '), $t_branches_input ); + + $t_branches_input_p1 = strpos( $t_branches_input, '