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

Re: [BUG?] HEAD detached at HEAD

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 21, 2015, 07:42 UTC
Message-ID
<vpqk2rkcj67.fsf@anie.imag.fr>
In-Reply-To
<55FFB43B.5080002@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 24 quoted lines
> ... in addition to my previous reply, looking at more context:
>
>>> --- a/wt-status.c
>>> +++ b/wt-status.c
>>> @@ -1319,6 +1319,13 @@ static int grab_1st_switch(unsigned char *osha1, unsigned char *nsha1,
>>>         hashcpy(cb->nsha1, nsha1);
>>>         for (end = target; *end && *end != '\n'; end++)
>>>                 ;
>>> +       if (!memcmp(target, "HEAD", end - target)) {
>>> +               /* Don't say "HEAD detached at HEAD" */
>>> +               unsigned char head[GIT_SHA1_RAWSZ];
>>> +               get_sha1("HEAD", head);
>>> +               strbuf_addstr(&cb->buf, find_unique_abbrev(head, DEFAULT_ABBREV));
>>> +               return 1;
>>> +       }
>>>         strbuf_add(&cb->buf, target, end - target);
>>>         return 1;
>>>  }
>>>
>>> What do you think?
>
> I think we should return (the hex repr. of) nsha1 instead of resolving
> HEAD at its current state. That should solve the present problem (and
> leave the more difficult reflog issue for the future).

Indeed, resolving HEAD to its current state is wrong. I'll submit a proper patch soon.

Thanks,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Michael J GruberNext: Junio C Hamano
Message 8 of 9 in “[BUG?] HEAD detached at HEAD”
  1. Matthieu MoySep 18, 2015
  2. Jacob KellerSep 18, 2015
  3. Matthieu MoySep 18, 2015
  4. Stefan BellerSep 18, 2015
  5. Matthieu MoySep 18, 2015
  6. Michael J GruberSep 21, 2015
  7. Michael J GruberSep 21, 2015
  8. Matthieu MoySep 21, 2015
  9. Junio C HamanoSep 21, 2015

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.