Merge branch 'dt/refs-backend-preamble'

In preparation for allowing different "backends" to store the refs
in a way different from the traditional "one ref per file in $GIT_DIR
or in a $GIT_DIR/packed-refs file" filesystem storage, reduce
direct filesystem access to ref-like things like CHERRY_PICK_HEAD
from scripts and programs.

* dt/refs-backend-preamble:
  git-stash: use update-ref --create-reflog instead of creating files
  update-ref and tag: add --create-reflog arg
  refs: add REF_FORCE_CREATE_REFLOG flag
  git-reflog: add exists command
  refs: new public ref function: safe_create_reflog
  refs: break out check for reflog autocreation
  refs.c: add err arguments to reflog functions
This commit is contained in:
Junio C Hamano
2015-08-03 11:01:29 -07:00
13 changed files with 238 additions and 85 deletions

5
refs.h
View File

@ -224,11 +224,12 @@ int pack_refs(unsigned int flags);
* Other flags are reserved for internal use.
*/
#define REF_NODEREF 0x01
#define REF_FORCE_CREATE_REFLOG 0x40
/*
* Setup reflog before using. Set errno to something meaningful on failure.
* Setup reflog before using. Fill in err and return -1 on failure.
*/
int log_ref_setup(const char *refname, struct strbuf *logfile);
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,