diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-05-06 15:45:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-08 14:31:43 -0700 |
commit | 4da588357a4a8b73f6a8d9c24435dabee74d0a7e (patch) | |
tree | 515b62219289f4f1769a47653f5136af1ccead8e /refs.h | |
parent | 1dc51c663c0a1c58c935677c614d31ddf687b3f1 (diff) | |
download | git-4da588357a4a8b73f6a8d9c24435dabee74d0a7e.tar.gz |
refs.c: add new functions reflog_exists and delete_reflog
Add two new functions, reflog_exists and delete_reflog, to hide the internal
reflog implementation (that they are files under .git/logs/...) from callers.
Update checkout.c to use these functions in update_refs_for_switch instead of
building pathnames and calling out to file access functions. Update reflog.c
to use these to check if the reflog exists. Now there are still many places
in reflog.c where we are still leaking the reflog storage implementation but
this at least reduces the number of such dependencies by one. Finally
change two places in refs.c itself to use the new function to check if a ref
exists or not isntead of build-path-and-stat(). Now, this is strictly not all
that important since these are in parts of refs that are implementing the
actual file storage backend but on the other hand it will not hurt either.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r-- | refs.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -173,6 +173,12 @@ 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); +/** Check if a particular reflog exists */ +extern int reflog_exists(const char *refname); + +/** Delete a reflog */ +extern int delete_reflog(const char *refname); + /* 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 *refname, each_reflog_ent_fn fn, void *cb_data); |