refs: new public ref function: safe_create_reflog
The safe_create_reflog function creates a reflog, if it does not already exist. The log_ref_setup function becomes private and gains a force_create parameter to force the creation of a reflog even if log_all_ref_updates is false or the refname is not one of the special refnames. The new parameter also reduces the need to store, modify, and restore the log_all_ref_updates global before reflog creation. In a moment, we will use this to add reflog creation commands to git-reflog. Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4e2bef57c9
commit
abd0cd3a30
2
refs.h
2
refs.h
@ -191,7 +191,7 @@ extern int peel_ref(const char *refname, unsigned char *sha1);
|
||||
/*
|
||||
* Setup reflog before using. Fill in err and return -1 on failure.
|
||||
*/
|
||||
int log_ref_setup(const char *refname, struct strbuf *logfile, struct strbuf *err);
|
||||
int safe_create_reflog(const char *refname, int force_create, struct strbuf *err);
|
||||
|
||||
/** Reads log for the value of ref during at_time. **/
|
||||
extern int read_ref_at(const char *refname, unsigned int flags,
|
||||
|
||||
Reference in New Issue
Block a user