git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin/commit.c: prevent bad commits

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 1, 2018, 16:37 UTC
Message-ID
<xmqq4lku2880.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180401140650.18928-1-alonid@gmail.com>
Dan Aloni <alonid@gmail.com> writes:
Show 10 quoted lines
> These commits which have hashes starting with the hex string 'bad',
> always give me the chills. Why should a perfectly good commit be
> jinxed?
> ...
> Note that this change does not affect actual software quality maintained
> using Git. Thus, it is recommended keep testing all generated versions
> regardless of commit hash jinxes.
>
> Signed-off-by: Dan Aloni <alonid@gmail.com>
> ---
Ah, I forgot that it's that time of the year again.
Show 10 quoted lines
> + ...
> +		oid_hex = oid_to_hex(&oid);
> +		if (prevent_bad &&
> +		    oid_hex[0] == 'b' &&
> +		    oid_hex[1] == 'a' &&
> +		    oid_hex[2] == 'd' )
> +		{
> +			parents = copy_parents;
> +			strbuf_add(&sb, "\n", 1);
> +			continue;

We used to allow a variant of this that lets you append invisible cruft at the end of the log message by hiding it after a NUL. You also could loop here to turn the abbreviated commit object name to an actively good one, not just "not bad" name ;-).

Show 8 quoted lines
> +		}
> +
> +		free_commit_list(copy_parents);
> +		break;
>  	}
> +
>  	strbuf_release(&author_ident);
>  	free_commit_extra_headers(extra);
Previous: Dan AloniNext: Jeff King
Message 2 of 3 in “builtin/commit.c: prevent bad commits”
  1. builtin/commit.c: prevent bad commitsDan Aloni, Apr 1, 2018
  2. Junio C HamanoApr 1, 2018
  3. Jeff KingApr 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.