Re: Bad error message
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:25
"Robin Rosenberg (list subscriber)" [off-list ref] writes:
quoted hunk
@@ -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.