@matheusbsbs / matheus-bagliano / commits / 5b10b09113
Fork 0

fsck-objects: adjust to resolve_ref() clean-up.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 18, 2006 at 01:08 UTC 5b10b091139ea5ef87376998c89f3a20dd7c7793
1 file changed +4 -6
fsck-objects.c
+4 -6
@@ -458,15 +458,13 @@ static void fsck_object_dir(const char *path)
458 static int fsck_head_link(void)
459 {
460 unsigned char sha1[20];
461 - const char *git_HEAD = xstrdup(git_path("HEAD"));
462 - const char *git_refs_heads_master = resolve_ref(git_HEAD, sha1, 1);
463 - int pfxlen = strlen(git_HEAD) - 4; /* strip .../.git/ part */
461 + const char *head_points_at = resolve_ref("HEAD", sha1, 1);
462
465 - if (!git_refs_heads_master)
463 + if (!head_points_at)
464 return error("HEAD is not a symbolic ref");
467 - if (strncmp(git_refs_heads_master + pfxlen, "refs/heads/", 11))
465 + if (strncmp(head_points_at, "refs/heads/", 11))
466 return error("HEAD points to something strange (%s)",
469 - git_refs_heads_master + pfxlen);
467 + head_points_at);
468 if (is_null_sha1(sha1))
469 return error("HEAD: not a valid git pointer");
470 return 0;