git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] worktree refs: fix case sensitivity for 'head'

From
Duy Nguyen <pclouds@gmail.com>
Date
Dec 13, 2018, 20:23 UTC
Message-ID
<CACsJy8AsRT+k4kdwC3gGjDOPiDn-L0GJs7-SQHb88Ra_gt4OcA@mail.gmail.com>
In-Reply-To
<13ee60e44f91ca06d182ff50fa4c69e137650fd2.1544730848.git.gitgitgadget@gmail.com>

On Thu, Dec 13, 2018 at 8:56 PM Michael Rappazzo via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 23 quoted lines
>
> From: Michael Rappazzo <rappazzo@gmail.com>
>
> 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 <rappazzo@gmail.com>
> ---
>  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
Previous: Michael Rappazzo via GitGitGadgetNext: Mike Rappazzo
Message 3 of 18 in “worktree refs: fix case sensitivity for 'head'”
  1. 0/1 worktree refs: fix case sensitivity for 'head'Michael Rappazzo via GitGitGadget, Dec 13, 2018
  2. 1/1 worktree refs: fix case sensitivity for 'head'Michael Rappazzo via GitGitGadget, Dec 13, 2018
  3. Duy NguyenDec 13, 2018
  4. Mike RappazzoDec 13, 2018
  5. Duy NguyenDec 13, 2018
  6. Stefan BellerDec 13, 2018
  7. Mike RappazzoDec 13, 2018
  8. brian m. carlsonDec 14, 2018
  9. Jacob KellerDec 14, 2018
  10. Duy NguyenDec 14, 2018
  11. Jacob KellerDec 14, 2018
  12. Duy NguyenDec 14, 2018
  13. Duy NguyenDec 14, 2018
  14. Jacob KellerDec 14, 2018
  15. Jacob KellerDec 14, 2018
  16. Mike RappazzoDec 13, 2018
  17. Junio C HamanoDec 14, 2018
  18. Johannes SchindelinDec 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.