From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] fsck-objects: adjust to resolve_ref() clean-up.
Date: Mon, 18 Sep 2006 11:44:25 -0700 [thread overview]
Message-ID: <7vac4xovzq.fsf@assigned-by-dhcp.cox.net> (raw)
Clean-up the same "ref to path and then back to ref" confusion.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
fsck-objects.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/fsck-objects.c b/fsck-objects.c
index 4d994f3..456c17e 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -458,15 +458,13 @@ static void fsck_object_dir(const char *
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;
--
1.4.2.1.g01ff
reply other threads:[~2006-09-18 18:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vac4xovzq.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox