1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

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:
epriestley 2013-12-09 13:22:13 -08:00
parent 5d27aeb240
commit 52462a46c0

View file

@ -100,6 +100,15 @@ final class ConduitAPI_diffusion_browsequery_Method
$results = array();
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
// correctly.