From: Junio C Hamano Date: Mon, 18 Sep 2006 08:08:00 +0000 (-0700) Subject: fsck-objects: adjust to resolve_ref() clean-up. X-Git-Tag: v1.4.4-rc1~43^2~32 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5b10b091139ea5ef87376998c89f3a20dd7c7793;p=git.git fsck-objects: adjust to resolve_ref() clean-up. Signed-off-by: Junio C Hamano --- diff --git a/fsck-objects.c b/fsck-objects.c index 4d994f3fc..456c17e2f 100644 --- a/fsck-objects.c +++ b/fsck-objects.c @@ -458,15 +458,13 @@ static void fsck_object_dir(const char *path) static int fsck_head_link(void) { unsigned char sha1[20]; - const char *git_HEAD = xstrdup(git_path("HEAD")); - const char *git_refs_heads_master = resolve_ref(git_HEAD, sha1, 1); - int pfxlen = strlen(git_HEAD) - 4; /* strip .../.git/ part */ + const char *head_points_at = resolve_ref("HEAD", sha1, 1); - if (!git_refs_heads_master) + if (!head_points_at) return error("HEAD is not a symbolic ref"); - if (strncmp(git_refs_heads_master + pfxlen, "refs/heads/", 11)) + if (strncmp(head_points_at, "refs/heads/", 11)) return error("HEAD points to something strange (%s)", - git_refs_heads_master + pfxlen); + head_points_at); if (is_null_sha1(sha1)) return error("HEAD: not a valid git pointer"); return 0;