mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Refine whitespace and end-of-block detection for git binary literal patches in
mercurial changesets Summary: Makes the parsing slightly more liberal so a test case from @Makinde passes. Test Plan: Ran unit tests. Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran Reviewed By: Makinde CC: aran, Makinde Differential Revision: 1054
This commit is contained in:
parent
930b32a6b4
commit
0b79132827
3 changed files with 14 additions and 4 deletions
|
@ -663,12 +663,14 @@ class ArcanistDiffParser {
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
$line = $this->nextLine();
|
$line = $this->nextLine();
|
||||||
if ($line === '') {
|
if ($line === '' || $line === null) {
|
||||||
|
// Some versions of Mercurial apparently omit the terminal newline,
|
||||||
|
// although it's unclear if Git will ever do this. In either case,
|
||||||
|
// rely on the base85 check for sanity.
|
||||||
$this->nextNonemptyLine();
|
$this->nextNonemptyLine();
|
||||||
return;
|
return;
|
||||||
} else if ($line === null) {
|
} else if (!preg_match('/^[a-zA-Z]/', $line)) {
|
||||||
throw new Exception(
|
$this->didFailParse("Expected base85 line length character (a-zA-Z).");
|
||||||
"Expected empty line to terminate binary patch.");
|
|
||||||
}
|
}
|
||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,6 +478,7 @@ EOTEXT
|
||||||
$change->getFileType());
|
$change->getFileType());
|
||||||
break;
|
break;
|
||||||
case 'hg-binary-change.hgdiff':
|
case 'hg-binary-change.hgdiff':
|
||||||
|
case 'hg-solo-binary-change.hgdiff':
|
||||||
$this->assertEqual(1, count($changes));
|
$this->assertEqual(1, count($changes));
|
||||||
$change = reset($changes);
|
$change = reset($changes);
|
||||||
$this->assertEqual(
|
$this->assertEqual(
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
diff --git a/x/inherit.gif b/x/inherit.gif
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..c814867a13deb0ca7ea2156c6ca1d5a03372af7e
|
||||||
|
GIT binary patch
|
||||||
|
literal 57
|
||||||
|
zc${<hbhEHb<Y(YxXkcLY|NlP&1A`6_Gk`=Gm?T>IIT!9-C*e{wE9>Kx3D)-;0v)C;
|
||||||
|
KYxQGgum%9JOA&7X
|
Loading…
Reference in a new issue