Raise a better error for malformed git ls-tree
Summary: Ref T4159. See T4159 for discussion. Test Plan: Faked the error and generated a reasonable error message. Reviewers: hach-que, btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4159 Differential Revision: https://secure.phabricator.com/D7744
This commit is contained in:
@@ -100,6 +100,15 @@ final class ConduitAPI_diffusion_browsequery_Method
|
|||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
foreach (explode("\0", rtrim($stdout)) as $line) {
|
foreach (explode("\0", rtrim($stdout)) as $line) {
|
||||||
|
if (substr_count($line, ' ') < 4) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Expected "<mode> <type> <hash> <size> <name>", for ls-tree of '.
|
||||||
|
'"%s:%s", got: %s',
|
||||||
|
$commit,
|
||||||
|
$path,
|
||||||
|
$line));
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Limit to 5 components so we parse filenames with spaces in them
|
// NOTE: Limit to 5 components so we parse filenames with spaces in them
|
||||||
// correctly.
|
// correctly.
|
||||||
|
|||||||
Reference in New Issue
Block a user