Merge branch 'hn/create-reflog-simplify' into hn/reftable-coverity-fixes

* hn/create-reflog-simplify:
  refs: drop force_create argument of create_reflog API
This commit is contained in:
Junio C Hamano
2021-12-07 12:45:15 -08:00
10 changed files with 18 additions and 23 deletions

View File

@@ -339,11 +339,10 @@ static int debug_reflog_exists(struct ref_store *ref_store, const char *refname)
}
static int debug_create_reflog(struct ref_store *ref_store, const char *refname,
int force_create, struct strbuf *err)
struct strbuf *err)
{
struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
int res = drefs->refs->be->create_reflog(drefs->refs, refname,
force_create, err);
int res = drefs->refs->be->create_reflog(drefs->refs, refname, err);
trace_printf_key(&trace_refs, "create_reflog: %s: %d\n", refname, res);
return res;
}

View File

@@ -1671,15 +1671,14 @@ error:
return -1;
}
static int files_create_reflog(struct ref_store *ref_store,
const char *refname, int force_create,
static int files_create_reflog(struct ref_store *ref_store, const char *refname,
struct strbuf *err)
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_WRITE, "create_reflog");
int fd;
if (log_ref_setup(refs, refname, force_create, &fd, err))
if (log_ref_setup(refs, refname, 1, &fd, err))
return -1;
if (fd >= 0)

View File

@@ -1629,8 +1629,7 @@ static int packed_reflog_exists(struct ref_store *ref_store,
}
static int packed_create_reflog(struct ref_store *ref_store,
const char *refname, int force_create,
struct strbuf *err)
const char *refname, struct strbuf *err)
{
BUG("packed reference store does not support reflogs");
}

View File

@@ -592,7 +592,7 @@ typedef int for_each_reflog_ent_reverse_fn(struct ref_store *ref_store,
void *cb_data);
typedef int reflog_exists_fn(struct ref_store *ref_store, const char *refname);
typedef int create_reflog_fn(struct ref_store *ref_store, const char *refname,
int force_create, struct strbuf *err);
struct strbuf *err);
typedef int delete_reflog_fn(struct ref_store *ref_store, const char *refname);
typedef int reflog_expire_fn(struct ref_store *ref_store,
const char *refname,