about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2009-01-06 21:37:23 +0100
committerLars Hjemli <hjemli@gmail.com>2009-01-06 21:37:23 +0100
commitf3c99cf1cee25ae95ffea6188b40734e877bce20 (patch)
tree6b996b4b1e8da4b8b56c8022036d5dce6d2d5e7f
parentui-patch: whitespace changes in the patch generation code (diff)
downloadcgit-pink-f3c99cf1cee25ae95ffea6188b40734e877bce20.tar.gz
cgit-pink-f3c99cf1cee25ae95ffea6188b40734e877bce20.zip
ui-tree.c: do not add blank line when displaying blobs
Also, fix a related bug in the test-suite.

Noticed-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rwxr-xr-xtests/t0104-tree.sh2
-rw-r--r--ui-tree.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index 0d62cc8..33f4eb0 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -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'
diff --git a/ui-tree.c b/ui-tree.c
index 79332fc..4bf372a 100644
--- 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");
 }
s='logheader'>2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe God that makes the lexers so much simpler. 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe This simplifies some things, adds support for line number tag definitions, and should enable combining htagml with other preprocessors in the future. 2021-01-12Split fields by tab onlyJune McEnroe Also don't fail hard on non-forward-search definitions. 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe neovim is laggy as hell in my OpenBSD VM, so I switched to vi so I could type without getting frustrated. 2021-01-09Add c -t flag to print expression typeJune McEnroe Also add missing float case. 2021-01-05Update taglineJune McEnroe