From: Jeff King Date: Tue, 7 Apr 2009 07:05:01 +0000 (-0400) Subject: for-each-ref: refactor get_short_ref function X-Git-Tag: v1.8.5-rc0~2^2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3d4ecc0e23b2b2f555e7d33b5623fd4e67cc2ac7?hp=3d4ecc0e23b2b2f555e7d33b5623fd4e67cc2ac7 for-each-ref: refactor get_short_ref function This function took a "refinfo" object which is unnecessarily restrictive; it only ever looked at the refname field. This patch refactors it to take just the ref name as a string. While we're touching the relevant lines, let's give it consistent memory semantics. Previously, some code paths would return an allocated string and some would return the original string; now it will always return a malloc'd string. This doesn't actually fix a bug or a leak, because for-each-ref doesn't clean up its memory, but it makes the function a lot less surprising for reuse (which will happen in a later patch). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano ---