From: Phillip Wood Date: Sat, 23 Nov 2019 09:54:49 GMT Subject: Re: [PATCH v2 1/1] sequencer: fix empty commit check when amending Message-ID: <340859a7-5cc4-f641-818d-fcedbf29a2a6@gmail.com> In-Reply-To: Hi Junio On 23/11/2019 02:03, Junio C Hamano wrote: > "Phillip Wood via GitGitGadget" writes: > >> + 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? That's a good point, I'll fix it, thanks for catching this Best Wishes Phillip > >> + 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; >> + } >> + }