[PATCH] Add a subject indicating that the commit message is empty
Nezmer
git at nezmer.info
Thu Aug 11 00:08:40 CEST 2011
Before this patch:
If the commit message is empty, we would have this html:
<a href='path'></a>
It's impossible to go to the commit page without viewing the source or
using hints (e.g vimperator).
After applying this patch:
A gitweb-like "(no commit message)" would be displayed as a commit
subject.
Signed-off-by: Nezmer <git at nezmer.info>
---
parsing.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/parsing.c b/parsing.c
index 602e3de..e96a325 100644
--- a/parsing.c
+++ b/parsing.c
@@ -200,6 +200,11 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
} else
ret->subject = xstrdup(p);
+ if (!strlen(ret->subject)) {
+ ret->subject = xmalloc(20);
+ ret->subject = xstrdup("(no commit message)");
+ }
+
reencode(&ret->author, ret->msg_encoding, PAGE_ENCODING);
reencode(&ret->author_email, ret->msg_encoding, PAGE_ENCODING);
reencode(&ret->committer, ret->msg_encoding, PAGE_ENCODING);
--
1.7.6
More information about the CGit
mailing list