Re: [PATCH v3 1/2] sequencer: replace error() with BUG() in update_squash_messages()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Lidong Yan via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> @@ -2067,6 +2067,9 @@ static int update_squash_messages(struct repository *r,
>  	const char *message, *body;
>  	const char *encoding = get_commit_output_encoding();
>  
> +	if (!is_fixup(command))
> +		BUG("unknown command: %d", command);

This is not necessarily unknown.  It may be a known one like
TODO_PICK but the reason why we are rejecting it is because it is
not either FIXUP or SQUASH, so we should say so.  BUG() is a message
to our developers, so a clear message that tells them that they are
not supposed to pass anything but FIXUP/SQUASH is far better than
saying "unknown".

>  	if (ctx->current_fixup_count > 0) {
>  		struct strbuf header = STRBUF_INIT;
>  		char *eol;
> @@ -2134,8 +2137,7 @@ static int update_squash_messages(struct repository *r,
>  		strbuf_addstr(&buf, "\n\n");
>  		strbuf_add_commented_lines(&buf, body, strlen(body),
>  					   comment_line_str);
> -	} else
> -		return error(_("unknown command: %d"), command);
> +	}
>  	repo_unuse_commit_buffer(r, commit, message);
>  
>  	if (!res)




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux