From: Phillip Wood Date: Thu, 22 Oct 2026 18:33:25 GMT Subject: Re: [PATCH v3 1/7] stash: use an enum for create status Message-ID: In-Reply-To: On 22/10/2026 18:01, Junio C Hamano wrote: > Phillip Wood writes: > >> On 21/10/2026 07:07, Junio C Hamano wrote: >>> Phillip Wood writes: >>> >>>> ret = stash_patch(info, ps, patch, quiet, interactive_opts); >>>> - if (ret < 0) { >>>> + if (ret == CREATE_ERROR) { >>>> if (!quiet) >>>> fprintf_ln(stderr, _("Cannot save the current " >>>> "worktree state")); >>>> goto done; >>>> - } else if (ret > 0) { >>>> + } else if (ret != CREATE_SUCCESS) { >>>> goto done; >>>> } >>> >>> I wonder if switch/case is easier to read for these users of these >>> enum return values. Some check explicitly against CREATE_ERROR >>> (like the one above), some treat anything other than CREATE_SUCCESS >>> as undesirable, etc. >> >> I've had a play with this and I think the enum is better here > > Puzzled. I wasn't contrasting enum vs switch. I was contrasting > if/else if cascade against switch, assuming that both use enum. Sorry s/enum/switch/ i.e I think the switch is better here (but not for all of them - see my previous mail) Thanks Phillip