From 0baf300c694b7fe3b9d4e8a1a3af347235c86b42 Mon Sep 17 00:00:00 2001 From: Ruslan Ostafiychuk Date: Sat, 4 Apr 2015 20:21:50 +0300 Subject: [PATCH] [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. --- .../git4idea/src/git4idea/history/GitLogParser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/history/GitLogParser.java b/plugins/git4idea/src/git4idea/history/GitLogParser.java index 35c798a425e2..4dd8f8d85b8f 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogParser.java +++ b/plugins/git4idea/src/git4idea/history/GitLogParser.java @@ -167,10 +167,20 @@ public class GitLogParser { // // R100 dir/anew.txt anew.txt final List 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 res = new ArrayList(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;