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);