[PATCH] Add a subject indicating that the commit message is empty

Nezmer git at nezmer.info
Thu Aug 11 00:16:45 CEST 2011


On Thu, Aug 11, 2011 at 01:08:40AM +0300, Nezmer wrote:
> 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
> 

Just sharing the idea here. I realize this might not be the right way to
implement this.




More information about the CGit mailing list