summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4349a66)
raw | patch | inline | side by side (parent: 4349a66)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Fri, 12 Aug 2011 22:36:26 +0000 (00:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 14 Aug 2011 22:18:52 +0000 (15:18 -0700) |
Change it to return a (struct ref_list *) instead of writing into
a cached_refs structure. (This removes the need to create a
cached_refs structure in resolve_gitlink_packed_ref(), where it
is otherwise unneeded.)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
a cached_refs structure. (This removes the need to create a
cached_refs structure in resolve_gitlink_packed_ref(), where it
is otherwise unneeded.)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c | patch | blob | history |
index df4ce42281ceff3dffe8b8d8bc1ae9292565f0d9..10aebcc68908b36ad6d59dbd86c5c32f76399229 100644 (file)
--- a/refs.c
+++ b/refs.c
clear_cached_refs(get_cached_refs(NULL));
}
-static void read_packed_refs(FILE *f, struct cached_refs *cached_refs)
+static struct ref_list *read_packed_refs(FILE *f)
{
struct ref_list *list = NULL;
struct ref_list *last = NULL;
!get_sha1_hex(refline + 1, sha1))
hashcpy(last->peeled, sha1);
}
- cached_refs->packed = sort_ref_list(list);
+ return sort_ref_list(list);
}
void add_extra_ref(const char *name, const unsigned char *sha1, int flag)
f = fopen(packed_refs_file, "r");
refs->packed = NULL;
if (f) {
- read_packed_refs(f, refs);
+ refs->packed = read_packed_refs(f);
fclose(f);
}
refs->did_packed = 1;
static int resolve_gitlink_packed_ref(char *name, int pathlen, const char *refname, unsigned char *result)
{
FILE *f;
- struct cached_refs refs;
+ struct ref_list *packed_refs;
struct ref_list *ref;
int retval;
@@ -399,9 +399,9 @@ static int resolve_gitlink_packed_ref(char *name, int pathlen, const char *refna
f = fopen(name, "r");
if (!f)
return -1;
- read_packed_refs(f, &refs);
+ packed_refs = read_packed_refs(f);
fclose(f);
- ref = refs.packed;
+ ref = packed_refs;
retval = -1;
while (ref) {
if (!strcmp(ref->name, refname)) {
@@ -411,7 +411,7 @@ static int resolve_gitlink_packed_ref(char *name, int pathlen, const char *refna
}
ref = ref->next;
}
- free_ref_list(refs.packed);
+ free_ref_list(packed_refs);
return retval;
}