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

Re: Bad error message

From
Junio C Hamano <junkio@cox.net>
Date
May 5, 2006, 00:20 UTC
Message-ID
<7vac9x2ug0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200605041957.26194.robin.rosenberg.lists@dewire.com>
"Robin Rosenberg (list subscriber)"  <robin.rosenberg.lists@dewire.com> writes:
Show 13 quoted lines
> @@ -43,8 +43,13 @@
>                 die("No such ref: %s", refname);
>
>         if (oldval) {
> -               if (memcmp(currsha1, oldsha1, 20))
> -                       die("Ref %s is at %s but expected %s", refname, sha1_to_hex(currsha1), sha1_to_hex(oldsha1));
> +               if (memcmp(currsha1, oldsha1, 20)) {
> +                       char sha1str1[41];
> +                       char sha1str2[41];
> +                       strcpy(sha1str1, sha1_to_hex(currsha1));
> +                       strcpy(sha1str2, sha1_to_hex(oldsha1));
> +                       die("Ref %s is at %s but expected %s", refname, sha1str1, sha1str2);
> +               }

Your patch looks correct, but probably is made unnecessary with the "you can use up to 4 sha1_to_hex() safely" patch Linus did.

We have it in "master" and my plan is to cherry-pick it to "maint" branch and included it in the next stale release 1.3.3, along with core.prefersymlinkrefs patch also only in "master", if we do not hear somebody scream in the next few days.

Previous: Robin Rosenberg (list subscriber)
Message 2 of 2 in “Bad error message”
  1. Robin Rosenberg (list subscriber)May 4, 2006
  2. Junio C HamanoMay 5, 2006

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.