From: Kristoffer Haugsbakk Date: Sun, 11 Feb 2024 18:16:05 GMT Subject: Re: Bug: Commit fails when no global email address is set even though --author is used Message-ID: <9c22f49a-538b-41eb-bdce-39e547c614ef@app.fastmail.com> In-Reply-To: On Fri, Feb 9, 2024, at 20:56, Junio C Hamano wrote: >> I think a three-way switch looks good. With the amendment that it steers >> you towards `user.*` instead of setting both `author.*` and >> `committer.*`. >> >> Something like >> >> • Author is set, not committer >> • Message: author is set but not committer: you might want to set >> *user* instead (prints suggested config) >> >> I can try to make a patch later. > > Wait. I didn't realize this when I wrote the message you are > responding to, but we *do* already suggest settig user.* variables. > > If the user chose to ignore that, then there isn't much we can do to > help, is there? > > Puzzled, but I'll stop here. Aye, good point. Maybe I misremembered and/or didn’t look carefully enough at the error message back when I set `author.*` instead of `user.*`. Maybe the error could say (back to the multi-way switch): ``` Author identity known, but committer identity unknown *** Please tell me who you are. Run git config --global user.email "code@khaugsbakk.name" git config --global user.name "Kristoffer Haugsbakk" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <>) not allowed ``` And then (see above) fill in the real information in the proposed config commands if the other identity is known. Maybe that could be accomplished with one more parameter to `ident_env_hint`: ``` static void ident_env_hint(enum want_ident whose_ident, char *other_ident) ``` (turned out to be a bit more tricky than I thought) But that’s a slightly longer error message, which (again) can cause the already-discussed glaze-over effect caused by the “wall of text”. -- Kristoffer Haugsbakk