diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2014-10-15 17:06:22 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-15 15:26:37 -0700 |
commit | 6ac05bfd7a432fb84ff5d0a6390083433cb22e47 (patch) | |
tree | f4d38611314811be1dcbc69b152228b23af3530f | |
parent | ae922f1983bb2c0b1aeaf34a8e51faed40cfc6ac (diff) | |
download | git-6ac05bfd7a432fb84ff5d0a6390083433cb22e47.tar.gz |
resove_gitlink_packed_ref(): inline function
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 31 |
1 files changed, 11 insertions, 20 deletions
@@ -1282,25 +1282,6 @@ static struct ref_dir *get_loose_refs(struct ref_cache *refs) /* We allow "recursive" symbolic refs. Only within reason, though */ #define MAXDEPTH 5 -/* - * Called by resolve_gitlink_ref_recursive() after it failed to read - * from the loose refs in ref_cache refs. Find <refname> in the - * packed-refs file for the submodule. - */ -static int resolve_gitlink_packed_ref(struct ref_cache *refs, - const char *refname, unsigned char *sha1) -{ - struct ref_entry *ref; - struct ref_dir *dir = get_packed_refs(refs); - - ref = find_ref(dir, refname); - if (ref == NULL) - return -1; - - hashcpy(sha1, ref->u.value.sha1); - return 0; -} - int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *sha1) { struct strbuf result = STRBUF_INIT; @@ -1333,7 +1314,17 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *sh if (parseval == 1) { ret = 0; } else if (parseval == -2) { - ret = resolve_gitlink_packed_ref(refs, result.buf, sha1) ? -1 : 0; + /* Loose ref doesn't exist; check for a packed ref */ + struct ref_entry *entry; + struct ref_dir *dir = get_packed_refs(refs); + + entry = find_ref(dir, result.buf); + if (entry) { + hashcpy(sha1, entry->u.value.sha1); + ret = 0; + } else { + ret = -1; + } } else { ret = -1; } |