summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cddc425)
raw | patch | inline | side by side (parent: cddc425)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Mon, 12 Dec 2011 05:38:23 +0000 (06:38 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 12 Dec 2011 17:08:53 +0000 (09:08 -0800) |
Take a pointer to the ref_entry to add to the array, rather than
creating the ref_entry within the function. This opens the way to
having multiple kinds of ref_entries.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
creating the ref_entry within the function. This opens the way to
having multiple kinds of ref_entries.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c | patch | blob | history |
index 442b87c9f84a1344e6883fa8ba2cdfc8aaba4731..579e4c3a18ddc093aac522477b41af032514d2dc 100644 (file)
--- a/refs.c
+++ b/refs.c
}
/* Add a ref_entry to the end of the ref_array (unsorted). */
-static void add_ref(const char *refname, const unsigned char *sha1,
- int flag, int check_name, struct ref_array *refs,
- struct ref_entry **new_ref)
+static void add_ref(struct ref_array *refs, struct ref_entry *ref)
{
- struct ref_entry *ref = create_ref_entry(refname, sha1, flag, check_name);
- if (new_ref)
- *new_ref = ref;
ALLOC_GROW(refs->refs, refs->nr + 1, refs->alloc);
refs->refs[refs->nr++] = ref;
}
refname = parse_ref_line(refline, sha1);
if (refname) {
- add_ref(refname, sha1, flag, 1, array, &last);
+ last = create_ref_entry(refname, sha1, flag, 1);
+ add_ref(array, last);
continue;
}
if (last &&
void add_extra_ref(const char *refname, const unsigned char *sha1, int flag)
{
- add_ref(refname, sha1, flag, 0, &extra_refs, NULL);
+ add_ref(&extra_refs, create_ref_entry(refname, sha1, flag, 0));
}
void clear_extra_refs(void)
hashclr(sha1);
flag |= REF_ISBROKEN;
}
- add_ref(refname, sha1, flag, 1, array, NULL);
+ add_ref(array, create_ref_entry(refname, sha1, flag, 1));
}
free(refname);
closedir(dir);