diff options
| author | Junio C Hamano <junkio@cox.net> | 2006-09-21 00:29:37 -0700 |
|---|---|---|
| committer | Junio C Hamano <junkio@cox.net> | 2006-09-21 00:29:37 -0700 |
| commit | 340adb8bccf48b9d933f0608fd99c75a5c28003c (patch) | |
| tree | 7f56898365b94fcac608f3d25788fd864570d2ca /fsck-objects.c | |
| parent | 9f613ddd21cbd05bfc139d9b1551b5780aa171f6 (diff) | |
| parent | 968846015229fe0fec28e3c85db722e131c15f93 (diff) | |
| download | git-340adb8bccf48b9d933f0608fd99c75a5c28003c.tar.gz | |
Merge branch 'lt/refs' into jc/for-each-ref-with-lt-refs
* lt/refs: (58 commits)
git-pack-refs --prune
pack-refs: do not pack symbolic refs.
Tell between packed, unpacked and symbolic refs.
Add callback data to for_each_ref() family.
symbolit-ref: fix resolve_ref conversion.
Fix broken sha1 locking
fsck-objects: adjust to resolve_ref() clean-up.
gitignore: git-pack-refs is a generated file.
wt-status: use simplified resolve_ref to find current branch
Fix t1400-update-ref test minimally
Enable the packed refs file format
Make ref resolution saner
Add support for negative refs
Start handling references internally as a sorted in-memory list
gitweb fix validating pg (page) parameter
git-repack(1): document --window and --depth
git-apply(1): document --unidiff-zero
gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
upload-archive: monitor child communication even more carefully.
gitweb: export options
...
Diffstat (limited to 'fsck-objects.c')
| -rw-r--r-- | fsck-objects.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fsck-objects.c b/fsck-objects.c index 4d994f3fc8..46b628cb94 100644 --- a/fsck-objects.c +++ b/fsck-objects.c @@ -402,7 +402,7 @@ static void fsck_dir(int i, char *path) static int default_refs; -static int fsck_handle_ref(const char *refname, const unsigned char *sha1) +static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) { struct object *obj; @@ -424,7 +424,7 @@ static int fsck_handle_ref(const char *refname, const unsigned char *sha1) static void get_default_heads(void) { - for_each_ref(fsck_handle_ref); + for_each_ref(fsck_handle_ref, NULL); /* * Not having any default heads isn't really fatal, but @@ -458,15 +458,14 @@ 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 */ + int flag; + const char *head_points_at = resolve_ref("HEAD", sha1, 1, &flag); - if (!git_refs_heads_master) + if (!head_points_at || !(flag & REF_ISSYMREF)) 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; |
