]> git.armaanb.net Git - stagit.git/commitdiff
Add config.def.h and make summary length configurable
authorFRIGN <dev@frign.de>
Mon, 14 Dec 2015 11:49:23 +0000 (12:49 +0100)
committerFRIGN <dev@frign.de>
Mon, 14 Dec 2015 11:49:58 +0000 (12:49 +0100)
Makefile
config.def.h [new file with mode: 0644]
urmoms.c

index 0c5ebd55dbe5edc56e492acb29d06620a15f2493..499b7078513a1df20c6f090f14187ca270730427 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,11 @@ dist: $(BIN)
        (cd release/${VERSION}; \
        tar -czf ../../urmoms-${VERSION}.tar.gz .)
 
-${OBJ}: config.mk ${HDR}
+${OBJ}: config.h config.mk ${HDR}
+
+config.h:
+       @echo creating $@ from config.def.h
+       @cp config.def.h $@
 
 urmoms: urmoms.o
        ${CC} -o $@ urmoms.o ${LDFLAGS}
diff --git a/config.def.h b/config.def.h
new file mode 100644 (file)
index 0000000..20a935a
--- /dev/null
@@ -0,0 +1,2 @@
+/* See LICENSE file for copyright and license details. */
+static const unsigned summarylen = 70; /* summary length in the log */
index b1c2aff05c7428c0397069b580cacc991ba61861..81ea49ef527e79fac41ed1cdc2b9e58a82c6258d 100644 (file)
--- a/urmoms.c
+++ b/urmoms.c
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "config.h"
 #include "git2.h"
 
 struct commitinfo {
@@ -428,9 +429,9 @@ writelog(FILE *fp)
                fputs("</td><td>", fp);
                if (ci->summary) {
                        fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid);
-                       if ((len = strlen(ci->summary)) > 79) {
-                               xmlencode(fp, ci->summary, 76);
-                               fputs("...", fp);
+                       if ((len = strlen(ci->summary)) > summarylen) {
+                               xmlencode(fp, ci->summary, summarylen - 1);
+                               fputs("", fp);
                        } else {
                                xmlencode(fp, ci->summary, len);
                        }