Subject: Re: [PATCH 12/15] use get_commit_buffer everywhere

From: Junio C Hamano <[email-masked]>
Date: Mon, 09 Jun 2014 15:40:57 -0700

Jeff King <[email-masked]> writes:

> diff --git a/notes-merge.c b/notes-merge.c
> index 94a1a8a..7885ab2 100644
> --- a/notes-merge.c
> +++ b/notes-merge.c
> @@ -671,7 +671,8 @@ int notes_merge_commit(struct notes_merge_options *o,
>  	DIR *dir;
>  	struct dirent *e;
>  	struct strbuf path = STRBUF_INIT;
> -	char *msg = strstr(partial_commit->buffer, "\n\n");
> +	const char *buffer = get_commit_buffer(partial_commit);
> +	const char *msg = strstr(buffer, "\n\n");

This tightening causes...

>  	struct strbuf sb_msg = STRBUF_INIT;
>  	int baselen;
>  
> @@ -720,6 +721,7 @@ int notes_merge_commit(struct notes_merge_options *o,
>  	}
>  
>  	strbuf_attach(&sb_msg, msg, strlen(msg), strlen(msg) + 1);

...a new error here:

notes-merge.c:723:2: error: passing argument 2 of 'strbuf_attach'
discards 'const' qualifier from pointer target type [-Werror]
strbuf.h:19:13: note: expected 'void *' but argument is of type
'const char *'