Skip to content

Commit 4597b31

Browse files
authored
Merge pull request #269 from Intuity/master
Importing an empty HgWeb repository causes lockup
2 parents 9edd313 + d0b8d00 commit 4597b31

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

SourceHgWeb/SourceHgWeb.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class SourceHgWebPlugin extends MantisSourcePlugin {
2121

22-
const PLUGIN_VERSION = '2.1.1';
22+
const PLUGIN_VERSION = '2.1.2';
2323
const FRAMEWORK_VERSION_REQUIRED = '2.0.0';
2424

2525
/**
@@ -251,7 +251,13 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
251251
$i = 0;
252252

253253
# Skip changeset header
254-
while( strpos( $t_input[$i++], '# HG changeset patch' ) === false );
254+
while( $i < count( $t_input ) && strpos( $t_input[$i++], '# HG changeset patch' ) === false );
255+
256+
# Check we haven't exhausted the input
257+
if ( $i == count( $t_input )) {
258+
echo "Unexpected HgWeb response (" . trim( $p_input ) . ") - repository may be empty.\n";
259+
return array (null, array());
260+
}
255261

256262
# Process changeset metadata
257263
$t_commit = array();

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ specification.
1010

1111
## [Unreleased 2.x]
1212

13+
### Fixed
14+
15+
- HgWeb: prevent lockup and display warning when importing empty repository
16+
[#269](https://github.com/mantisbt-plugins/source-integration/pull/269)
17+
18+
1319
--------------------------------------------------------------------------------
1420

1521
# Releases for MantisBT 2.x

0 commit comments

Comments
 (0)