From: Duy Nguyen Date: Thu, 13 Dec 2018 20:23:17 GMT Subject: Re: [PATCH 1/1] worktree refs: fix case sensitivity for 'head' Message-ID: In-Reply-To: <13ee60e44f91ca06d182ff50fa4c69e137650fd2.1544730848.git.gitgitgadget@gmail.com> On Thu, Dec 13, 2018 at 8:56 PM Michael Rappazzo via GitGitGadget wrote: > > From: Michael Rappazzo > > On a worktree which is not the primary, using the symbolic-ref 'head' was > incorrectly pointing to the main worktree's HEAD. The same was true for > any other case of the word 'Head'. > > Signed-off-by: Michael Rappazzo > --- > refs.c | 8 ++++---- > t/t1415-worktree-refs.sh | 9 +++++++++ > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/refs.c b/refs.c > index f9936355cd..963e786458 100644 > --- a/refs.c > +++ b/refs.c > @@ -579,7 +579,7 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref) > *ref = xstrdup(r); > if (!warn_ambiguous_refs) > break; > - } else if ((flag & REF_ISSYMREF) && strcmp(fullref.buf, "HEAD")) { > + } else if ((flag & REF_ISSYMREF) && strcasecmp(fullref.buf, "HEAD")) { This is not going to work. How about ~40 other "strcmp.*HEAD" instances? All refs are case-sensitive and this probably will not change even when we introduce new ref backends. > warning(_("ignoring dangling symref %s"), fullref.buf); > } else if ((flag & REF_ISBROKEN) && strchr(fullref.buf, '/')) { > warning(_("ignoring broken ref %s"), fullref.buf); -- Duy