Re: [PATCH v2 1/1] sequencer: fix empty commit check when amending
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 23, 2019, 02:03 UTC
- Message-ID
- <xmqq5zjb2vsx.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <037f2b2975e06847443aef46939e3c712053dedf.1574451783.git.gitgitgadget@gmail.com>
"Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> + if (!(flags & ALLOW_EMPTY)) {
> + struct commit *first_parent = current_head;
> +
> + if (flags & AMEND_MSG) {
> + if (current_head->parents) {It is not apparent to me that somebody guarantees that this access is safe; would we need to do things differently when !current_head?
Show 9 quoted lines
> + first_parent = current_head->parents->item;
> + if (repo_parse_commit(r, first_parent)) {
> + res = error(_("could not parse HEAD commit"));
> + goto out;
> + }
> + } else {
> + first_parent = NULL;
> + }
> + }