Re: [PATCH v2 1/1] branch: introduce --show-current display option
- From
Daniels Umanovskis <daniels@umanovskis.se>
- Date
- Oct 11, 2018, 17:29 UTC
- Message-ID
- <0f401a50-3c4c-5d09-a8b1-58ae80f5a210@umanovskis.se>
- In-Reply-To
- <xmqq4ldtgehs.fsf@gitster-ct.c.googlers.com>
On 10/11/18 8:54 AM, Junio C Hamano wrote:
> Is it a normal situation to have refname==NULL, or is it something > worth reporting as an error?
Looks like that would be in the case of looping symrefs or file backend failure, so seems a good idea to die() in that case.
> Without passing the &flag argument, I do not think there is a > reliable way to ask resolve_ref_unsafe() if "HEAD" is a symbolic > ref.
If I'm reading the code correctly, resolve_ref_unsafe() will return "HEAD" or NULL if there's no symbolic reference, so anything else would indicate a symref, but even in that case checking the flag explicitly is definitely better to clearly show intent.
Will soon reply with v3 cleaning up the suggested patch accordingly.