Merge branch 'mh/packed-refs-various'
Update reading and updating packed-refs file, correcting corner case bugs. * mh/packed-refs-various: (33 commits) refs: handle the main ref_cache specially refs: change do_for_each_*() functions to take ref_cache arguments pack_one_ref(): do some cheap tests before a more expensive one pack_one_ref(): use write_packed_entry() to do the writing pack_one_ref(): use function peel_entry() refs: inline function do_not_prune() pack_refs(): change to use do_for_each_entry() refs: use same lock_file object for both ref-packing functions pack_one_ref(): rename "path" parameter to "refname" pack-refs: merge code from pack-refs.{c,h} into refs.{c,h} pack-refs: rename handle_one_ref() to pack_one_ref() refs: extract a function write_packed_entry() repack_without_ref(): write peeled refs in the rewritten file t3211: demonstrate loss of peeled refs if a packed ref is deleted refs: change how packed refs are deleted search_ref_dir(): return an index rather than a pointer repack_without_ref(): silence errors for dangling packed refs t3210: test for spurious error messages for dangling packed refs refs: change the internal reference-iteration API refs: extract a function peel_entry() ...
This commit is contained in:
35
refs.h
35
refs.h
@ -10,8 +10,21 @@ struct ref_lock {
|
||||
int force_write;
|
||||
};
|
||||
|
||||
/*
|
||||
* Bit values set in the flags argument passed to each_ref_fn():
|
||||
*/
|
||||
|
||||
/* Reference is a symbolic reference. */
|
||||
#define REF_ISSYMREF 0x01
|
||||
|
||||
/* Reference is a packed reference. */
|
||||
#define REF_ISPACKED 0x02
|
||||
|
||||
/*
|
||||
* Reference cannot be resolved to an object name: dangling symbolic
|
||||
* reference (directly or indirectly), corrupt reference file, or
|
||||
* symbolic reference refers to ill-formatted reference name.
|
||||
*/
|
||||
#define REF_ISBROKEN 0x04
|
||||
|
||||
/*
|
||||
@ -59,8 +72,30 @@ extern void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refn
|
||||
*/
|
||||
extern void add_packed_ref(const char *refname, const unsigned char *sha1);
|
||||
|
||||
/*
|
||||
* Flags for controlling behaviour of pack_refs()
|
||||
* PACK_REFS_PRUNE: Prune loose refs after packing
|
||||
* PACK_REFS_ALL: Pack _all_ refs, not just tags and already packed refs
|
||||
*/
|
||||
#define PACK_REFS_PRUNE 0x0001
|
||||
#define PACK_REFS_ALL 0x0002
|
||||
|
||||
/*
|
||||
* Write a packed-refs file for the current repository.
|
||||
* flags: Combination of the above PACK_REFS_* flags.
|
||||
*/
|
||||
int pack_refs(unsigned int flags);
|
||||
|
||||
extern int ref_exists(const char *);
|
||||
|
||||
/*
|
||||
* If refname is a non-symbolic reference that refers to a tag object,
|
||||
* and the tag can be (recursively) dereferenced to a non-tag object,
|
||||
* store the SHA1 of the referred-to object to sha1 and return 0. If
|
||||
* any of these conditions are not met, return a non-zero value.
|
||||
* Symbolic references are considered unpeelable, even if they
|
||||
* ultimately resolve to a peelable tag.
|
||||
*/
|
||||
extern int peel_ref(const char *refname, unsigned char *sha1);
|
||||
|
||||
/** Locks a "refs/" ref returning the lock on success and NULL on failure. **/
|
||||
|
Reference in New Issue
Block a user