From 3344661c56c6380eca2c4de37d2dd618d73b522b Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Wed, 10 Feb 2016 14:58:14 +0100 Subject: [PATCH 1/2] better error msg when commit url is not accessible --- SourceGitweb/SourceGitweb.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SourceGitweb/SourceGitweb.php b/SourceGitweb/SourceGitweb.php index 6df340475..4e4a3d56a 100644 --- a/SourceGitweb/SourceGitweb.php +++ b/SourceGitweb/SourceGitweb.php @@ -232,6 +232,11 @@ private function import_commits( $p_repo, $p_uri_base, $p_commit_ids, $p_branch= echo "$t_commit_url\n"; # DEBUG continue; } + if ( $t_input == '' ) { + echo "empty input found.\n"; + echo "Make sure \"$t_commit_url\" is accessible.\n"; + die(); + } list( $t_changeset, $t_commit_parents ) = $this->commit_changeset( $p_repo, $t_input, $p_branch ); if ( !is_null( $t_changeset ) ) { @@ -254,7 +259,7 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) { $t_input_p1 = strpos( $t_input, '
' ); $t_input_p2 = strpos( $t_input, '
' ); if ( false === $t_input_p1 || false === $t_input_p2 ) { - echo 'commit data failure.'; + echo "commit data failure.\n"; var_dump( strlen( $t_input ), $t_input_p1, $t_input_p2 ); die(); } From e8c9f10b1cede309ec6a00984cdd3f521dbbd289 Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Thu, 11 Feb 2016 14:10:28 +0100 Subject: [PATCH 2/2] simpler check for truth of $t_commit_url data --- SourceGitweb/SourceGitweb.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/SourceGitweb/SourceGitweb.php b/SourceGitweb/SourceGitweb.php index 4e4a3d56a..1d85bcc0a 100644 --- a/SourceGitweb/SourceGitweb.php +++ b/SourceGitweb/SourceGitweb.php @@ -227,14 +227,9 @@ private function import_commits( $p_repo, $p_uri_base, $p_commit_ids, $p_branch= $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; - } - if ( $t_input == '' ) { - echo "empty input found.\n"; - echo "Make sure \"$t_commit_url\" is accessible.\n"; + if ( !$t_input ) { + echo "failed.\nno input found.\n"; + echo "The data returned from accessing \"$t_commit_url\" returned a FALSE value.\n"; die(); }