summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6ed3ca)
raw | patch | inline | side by side (parent: e6ed3ca)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Tue, 17 Jan 2012 05:50:33 +0000 (06:50 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 17 Jan 2012 19:55:04 +0000 (11:55 -0800) |
Add a new function add_packed_ref() that adds a reference directly to
the in-memory packed reference cache. This will be useful for
creating local references while cloning.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the in-memory packed reference cache. This will be useful for
creating local references while cloning.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c | patch | blob | history | |
refs.h | patch | blob | history |
index 3785cc200ca1e76963f43b34994f2272210099b2..b8843bb4769a2c5e3496d962f8d6b85a483fa92e 100644 (file)
--- a/refs.c
+++ b/refs.c
return &refs->packed;
}
+void add_packed_ref(const char *refname, const unsigned char *sha1)
+{
+ add_ref(get_packed_refs(get_ref_cache(NULL)),
+ create_ref_entry(refname, sha1, REF_ISPACKED, 1));
+}
+
static void get_ref_dir(struct ref_cache *refs, const char *base,
struct ref_array *array)
{
index d4982915c58c7c17229e4a6621d02337e2550e13..00ba1e2813b2c2fff74300e3b2036a04f9e28065 100644 (file)
--- a/refs.h
+++ b/refs.h
extern void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname);
+/*
+ * Add a reference to the in-memory packed reference cache. To actually
+ * write the reference to the packed-refs file, call pack_refs().
+ */
+extern void add_packed_ref(const char *refname, const unsigned char *sha1);
+
/*
* Extra refs will be listed by for_each_ref() before any actual refs
* for the duration of this process or until clear_extra_refs() is