From 09336aa48a8c15f93ce68ef4585d526ba06f9feb Mon Sep 17 00:00:00 2001
From: Sergey Matveev <stargrave@stargrave.org>
Date: Fri, 17 Jul 2015 15:55:07 +0300
Subject: [PATCH] Add line, not the range if single line is commented only

---
 gerrvim2json.pl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gerrvim2json.pl b/gerrvim2json.pl
index 0cf9c86..bd52c42 100755
--- a/gerrvim2json.pl
+++ b/gerrvim2json.pl
@@ -54,10 +54,7 @@ is transformed to JSON like this:
           },
           {
             "message": "Remove that.",
-            "range": {
-              "end_line": "2",
-              "start_line": "1"
-            }
+            "line": 1
           }
         ]
       }
@@ -115,10 +112,13 @@ sub buf2str {
 
 sub comment_done {
     ($comments{$filename} = []) unless defined $comments{$filename};
-    push @{$comments{$filename}}, {
-        range => {start_line => $linebgn, end_line => $lineend},
-        message => buf2str,
+    my %c = ("message" => buf2str);
+    if ($lineend - $linebgn == 1) {
+        $c{"line"} = $linebgn;
+    } else {
+        $c{"range"} = {start_line => $linebgn, end_line => $lineend};
     };
+    push @{$comments{$filename}}, \%c;
 }
 
 while (<>) {
-- 
2.51.0