Merge branch 'mh/ref-api'
* mh/ref-api: add_ref(): take a (struct ref_entry *) parameter create_ref_entry(): extract function from add_ref() repack_without_ref(): remove temporary resolve_gitlink_ref_recursive(): change to work with struct ref_cache Pass a (ref_cache *) to the resolve_gitlink_*() helper functions resolve_gitlink_ref(): improve docstring get_ref_dir(): change signature refs: change signatures of get_packed_refs() and get_loose_refs() is_dup_ref(): extract function from sort_ref_array() add_ref(): add docstring parse_ref_line(): add docstring is_refname_available(): remove the "quiet" argument clear_ref_array(): rename from free_ref_array() refs: rename parameters result -> sha1 refs: rename "refname" variables struct ref_entry: document name member Conflicts: cache.h refs.c
This commit is contained in:
commit
8d68493f20
4
cache.h
4
cache.h
@ -833,9 +833,9 @@ static inline int get_sha1_with_context(const char *str, unsigned char *sha1, st
|
||||
extern int get_sha1_hex(const char *hex, unsigned char *sha1);
|
||||
|
||||
extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
|
||||
extern int read_ref_full(const char *filename, unsigned char *sha1,
|
||||
extern int read_ref_full(const char *refname, unsigned char *sha1,
|
||||
int reading, int *flags);
|
||||
extern int read_ref(const char *filename, unsigned char *sha1);
|
||||
extern int read_ref(const char *refname, unsigned char *sha1);
|
||||
|
||||
/*
|
||||
* Resolve a reference, recursively following symbolic refererences.
|
||||
|
34
refs.h
34
refs.h
@ -60,14 +60,16 @@ extern void add_extra_ref(const char *refname, const unsigned char *sha1, int fl
|
||||
extern void clear_extra_refs(void);
|
||||
extern int ref_exists(const char *);
|
||||
|
||||
extern int peel_ref(const char *, unsigned char *);
|
||||
extern int peel_ref(const char *refname, unsigned char *sha1);
|
||||
|
||||
/** Locks a "refs/" ref returning the lock on success and NULL on failure. **/
|
||||
extern struct ref_lock *lock_ref_sha1(const char *ref, const unsigned char *old_sha1);
|
||||
extern struct ref_lock *lock_ref_sha1(const char *refname, const unsigned char *old_sha1);
|
||||
|
||||
/** Locks any ref (for 'HEAD' type refs). */
|
||||
#define REF_NODEREF 0x01
|
||||
extern struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1, int flags);
|
||||
extern struct ref_lock *lock_any_ref_for_update(const char *refname,
|
||||
const unsigned char *old_sha1,
|
||||
int flags);
|
||||
|
||||
/** Close the file descriptor owned by a lock and return the status */
|
||||
extern int close_ref(struct ref_lock *lock);
|
||||
@ -93,12 +95,14 @@ extern void invalidate_ref_cache(const char *submodule);
|
||||
int log_ref_setup(const char *ref_name, char *logfile, int bufsize);
|
||||
|
||||
/** Reads log for the value of ref during at_time. **/
|
||||
extern int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
|
||||
extern int read_ref_at(const char *refname, unsigned long at_time, int cnt,
|
||||
unsigned char *sha1, char **msg,
|
||||
unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
|
||||
|
||||
/* iterate over reflog entries */
|
||||
typedef int each_reflog_ent_fn(unsigned char *osha1, unsigned char *nsha1, const char *, unsigned long, int, const char *, void *);
|
||||
int for_each_reflog_ent(const char *ref, each_reflog_ent_fn fn, void *cb_data);
|
||||
int for_each_recent_reflog_ent(const char *ref, each_reflog_ent_fn fn, long, void *cb_data);
|
||||
int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void *cb_data);
|
||||
int for_each_recent_reflog_ent(const char *refname, each_reflog_ent_fn fn, long, void *cb_data);
|
||||
|
||||
/*
|
||||
* Calls the specified function for each reflog file until it returns nonzero,
|
||||
@ -111,9 +115,9 @@ extern int for_each_reflog(each_ref_fn, void *);
|
||||
#define REFNAME_DOT_COMPONENT 4
|
||||
|
||||
/*
|
||||
* Return 0 iff ref has the correct format for a refname according to
|
||||
* the rules described in Documentation/git-check-ref-format.txt. If
|
||||
* REFNAME_ALLOW_ONELEVEL is set in flags, then accept one-level
|
||||
* Return 0 iff refname has the correct format for a refname according
|
||||
* to the rules described in Documentation/git-check-ref-format.txt.
|
||||
* If REFNAME_ALLOW_ONELEVEL is set in flags, then accept one-level
|
||||
* reference names. If REFNAME_REFSPEC_PATTERN is set in flags, then
|
||||
* allow a "*" wildcard character in place of one of the name
|
||||
* components. No leading or repeated slashes are accepted. If
|
||||
@ -121,16 +125,20 @@ extern int for_each_reflog(each_ref_fn, void *);
|
||||
* components to start with "." (but not a whole component equal to
|
||||
* "." or "..").
|
||||
*/
|
||||
extern int check_refname_format(const char *ref, int flags);
|
||||
extern int check_refname_format(const char *refname, int flags);
|
||||
|
||||
extern const char *prettify_refname(const char *refname);
|
||||
extern char *shorten_unambiguous_ref(const char *ref, int strict);
|
||||
extern char *shorten_unambiguous_ref(const char *refname, int strict);
|
||||
|
||||
/** rename ref, return 0 on success **/
|
||||
extern int rename_ref(const char *oldref, const char *newref, const char *logmsg);
|
||||
|
||||
/** resolve ref in nested "gitlink" repository */
|
||||
extern int resolve_gitlink_ref(const char *name, const char *refname, unsigned char *result);
|
||||
/**
|
||||
* Resolve refname in the nested "gitlink" repository that is located
|
||||
* at path. If the resolution is successful, return 0 and set sha1 to
|
||||
* the name of the object; otherwise, return a non-zero value.
|
||||
*/
|
||||
extern int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *sha1);
|
||||
|
||||
/** lock a ref and then write its file */
|
||||
enum action_on_err { MSG_ON_ERR, DIE_ON_ERR, QUIET_ON_ERR };
|
||||
|
Loading…
Reference in New Issue
Block a user