path: root/builtin/fsck.c
diff options
authorNguyễn Thái Ngọc Duy <>2011-12-12 11:20:32 (GMT)
committerJunio C Hamano <>2011-12-13 17:39:46 (GMT)
commit8cad4744ee37ebec1d9491a1381ec1771a1ba795 (patch)
tree064bbe938f38727dd163aae9c95e2185b8075234 /builtin/fsck.c
parent96ec7b1e708863d0cd6b8e72a986d6f0a1bb64db (diff)
Rename resolve_ref() to resolve_ref_unsafe()
resolve_ref() may return a pointer to a shared buffer and can be overwritten by the next resolve_ref() calls. Callers need to pay attention, not to keep the pointer when the next call happens. Rename with "_unsafe" suffix to warn developers (or reviewers) before introducing new call sites. This patch is generated using the following command git grep -l 'resolve_ref(' -- '*.[ch]'|xargs sed -i 's/resolve_ref(/resolve_ref_unsafe(/g' Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/fsck.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 30d0dc8..8c479a7 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -563,7 +563,7 @@ static int fsck_head_link(void)
if (verbose)
fprintf(stderr, "Checking HEAD link\n");
- head_points_at = resolve_ref("HEAD", head_sha1, 0, &flag);
+ head_points_at = resolve_ref_unsafe("HEAD", head_sha1, 0, &flag);
if (!head_points_at)
return error("Invalid HEAD");
if (!strcmp(head_points_at, "HEAD"))