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>
This commit is contained in:
parent
e6ed3ca651
commit
30249ee68f
6
refs.c
6
refs.c
@ -319,6 +319,12 @@ static struct ref_array *get_packed_refs(struct ref_cache *refs)
|
|||||||
return &refs->packed;
|
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,
|
static void get_ref_dir(struct ref_cache *refs, const char *base,
|
||||||
struct ref_array *array)
|
struct ref_array *array)
|
||||||
{
|
{
|
||||||
|
6
refs.h
6
refs.h
@ -50,6 +50,12 @@ extern int for_each_rawref(each_ref_fn, void *);
|
|||||||
|
|
||||||
extern void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname);
|
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
|
* 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
|
* for the duration of this process or until clear_extra_refs() is
|
||||||
|
Loading…
Reference in New Issue
Block a user