diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-12-12 06:38:45 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-12 09:08:56 -0800 |
commit | a3c9d83c05225bdcfa696b851e7f7f71dc61c64d (patch) | |
tree | 6dd9e6421b0616e1b6e30e20d11f273159f7907f | |
parent | db664888318d560e258cd1b5ff177cc28bc0de78 (diff) | |
download | git-a3c9d83c05225bdcfa696b851e7f7f71dc61c64d.tar.gz |
find_ref(): take (ref_entry *) instead of (ref_dir *)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -321,10 +321,12 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir, * subdirectories as necessary. If the name is not found or it * corresponds to a directory entry, return NULL. */ -static struct ref_entry *find_ref(struct ref_dir *dir, const char *refname) +static struct ref_entry *find_ref(struct ref_entry *direntry, const char *refname) { struct ref_entry *entry; - dir = find_containing_dir(dir, refname, 0); + struct ref_dir *dir; + assert(direntry->flag & REF_DIR); + dir = find_containing_dir(&direntry->u.subdir, refname, 0); if (!dir) return NULL; entry = search_ref_dir(dir, refname); @@ -835,7 +837,7 @@ static int resolve_gitlink_packed_ref(struct ref_cache *refs, struct ref_entry *ref; struct ref_entry *direntry = get_packed_refs(refs); - ref = find_ref(&direntry->u.subdir, refname); + ref = find_ref(direntry, refname); if (ref == NULL) return -1; @@ -907,7 +909,7 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *sh static int get_packed_ref(const char *refname, unsigned char *sha1) { struct ref_entry *packed = get_packed_refs(get_ref_cache(NULL)); - struct ref_entry *entry = find_ref(&packed->u.subdir, refname); + struct ref_entry *entry = find_ref(packed, refname); if (entry) { hashcpy(sha1, entry->u.value.sha1); return 0; @@ -1078,7 +1080,7 @@ int peel_ref(const char *refname, unsigned char *sha1) if ((flag & REF_ISPACKED)) { struct ref_entry *direntry = get_packed_refs(get_ref_cache(NULL)); - struct ref_entry *r = find_ref(&direntry->u.subdir, refname); + struct ref_entry *r = find_ref(direntry, refname); if (r != NULL && r->flag & REF_KNOWS_PEELED) { hashcpy(sha1, r->u.value.peeled); @@ -1608,7 +1610,7 @@ static int repack_without_ref(const char *refname) { struct repack_without_ref_sb data; struct ref_entry *packed = get_packed_refs(get_ref_cache(NULL)); - if (find_ref(&packed->u.subdir, refname) == NULL) + if (find_ref(packed, refname) == NULL) return 0; data.refname = refname; data.fd = hold_lock_file_for_update(&packlock, git_path("packed-refs"), 0); |