]> granicus.if.org Git - cgit/commitdiff
ui-tree.c: do not add blank line when displaying blobs
authorLars Hjemli <hjemli@gmail.com>
Tue, 6 Jan 2009 20:37:23 +0000 (21:37 +0100)
committerLars Hjemli <hjemli@gmail.com>
Tue, 6 Jan 2009 20:37:23 +0000 (21:37 +0100)
Also, fix a related bug in the test-suite.

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
tests/t0104-tree.sh
ui-tree.c

index 0d62cc82c5d5dbbc90e351a73e3c748e427ba7c0..33f4eb00ff2808e9f4335b397e809d695b464301 100755 (executable)
@@ -15,7 +15,7 @@ run_test 'find line 1' '
 '
 
 run_test 'no line 2' '
-       grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
+       grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
 '
 
 run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp'
index 79332fc9eb22cc83bf4a098abcaf32102862b4d1..4bf372a6ce73b75984b1959149193b16266e4642 100644 (file)
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -54,8 +54,10 @@ static void print_object(const unsigned char *sha1, char *path)
                }
                idx++;
        }
-       htmlf(linefmt, ++lineno);
-       html_txt(buf + start);
+       if (start < idx) {
+               htmlf(linefmt, ++lineno);
+               html_txt(buf + start);
+       }
        html("</td></tr>\n");
        html("</table>\n");
 }