1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Use Git's encoding flag instead of MBString

Summary:
0d5b0f21ad added string conversion but MBString always needs an argument for endcoding.

It looks like we can get away with doing this in git instead, with the --encoding='UTF-8' flag. Then we should be safe to remove the test for output type, and stay UTF-8 safe.

Test Plan:
Run updaters with change. Verify commits are updated.

Reviewers: epriestley

CC:

Differential Revision: 1108
This commit is contained in:
John Stockdale 2011-11-12 00:06:44 +00:00
parent 5c21b5345d
commit 501c90bb30

View file

@ -26,15 +26,10 @@ class PhabricatorRepositoryGitCommitMessageParserWorker
// NOTE: %B was introduced somewhat recently in git's history, so pull
// commit message information with %s and %b instead.
list($info) = $repository->execxLocalCommand(
'log -n 1 --pretty=format:%%e%%x00%%an%%x00%%s%%n%%n%%b %s',
"log -n 1 --encoding='UTF-8' --pretty=format:%%an%%x00%%s%%n%%n%%b %s",
$commit->getCommitIdentifier());
list($encoding, $author, $message) = explode("\0", $info);
if ($encoding != "UTF-8") {
$author = mb_convert_encoding($author, 'UTF-8', $encoding);
$message = mb_convert_encoding($message, 'UTF-8', $encoding);
}
list($author, $message) = explode("\0", $info);
// Make sure these are valid UTF-8.
$author = phutil_utf8ize($author);