eclair/prepare_gerrit_comment: Fix size trimming logic

Previously, we appended a new line and then checked for size limit, which
still could lead to size overflow. Now check for size before appending a
new line.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ib0c55ba52c36e6db9b0fb0d41ed790473af1e9e0
diff --git a/eclair/prepare_gerrit_comment.py b/eclair/prepare_gerrit_comment.py
index 1ef0052..b5281b2 100755
--- a/eclair/prepare_gerrit_comment.py
+++ b/eclair/prepare_gerrit_comment.py
@@ -18,8 +18,7 @@
 
 with open(sys.argv[1], "r") as f:
     for l in f:
-        body += l
-        if len(body) >= SIZE_LIMIT:
+        if len(body) + len(l) >= SIZE_LIMIT:
             body += """\
 [...]
 
@@ -27,5 +26,6 @@
 Follow the link at the beginning to see the full report.
 """
             break
+        body += l
 
 sys.stdout.write(shlex.quote(body))