summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2012-01-17 06:50:33 +0100
committerJunio C Hamano <gitster@pobox.com>2012-01-17 11:55:04 -0800
commit30249ee68fa5fa63bfb9bb417987b0547253b8e7 (patch)
treefd474eab1ad3af967bafb425fa6bcc00b209ebc5 /refs.c
parente6ed3ca651fac702f9d9a9ef64a14c7efadf7365 (diff)
downloadgit-30249ee68fa5fa63bfb9bb417987b0547253b8e7.tar.gz
add_packed_ref(): new function in the refs API.
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 3785cc200c..b8843bb476 100644
--- a/refs.c
+++ b/refs.c
@@ -319,6 +319,12 @@ static struct ref_array *get_packed_refs(struct ref_cache *refs)
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)
{