[git] IDEA-128280 workaround control chars in commit message

let parser survive against \u0001 characters found in the commit message,
as well as against \u0003, but not both of them yet.
This commit is contained in:
Ruslan Ostafiychuk
2015-04-05 16:54:02 +03:00
committed by Kirill Likhodedov
parent 948e2e56da
commit 0baf300c69
@@ -167,10 +167,20 @@ public class GitLogParser {
//
// R100 dir/anew.txt anew.txt
final List<String> records = StringUtil.split(output, RECORD_START); // split by START, because END is the end of information, but not the end of the record: file status and path follow.
String notMatchedPart = null;
final List<GitLogRecord> res = new ArrayList<GitLogRecord>(records.size());
for (String record : records) {
if (!record.trim().isEmpty()) { // record[0] is empty for sure, because we're splitting on RECORD_START. Just to play safe adding the check for all records.
res.add(parseOneRecord(record));
if (notMatchedPart != null) {
record = notMatchedPart + record;
}
if (ONE_RECORD.matcher(record).matches()) {
notMatchedPart = null;
res.add(parseOneRecord(record));
}
else {
notMatchedPart = record;
}
}
}
return res;