aboutsummaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-06 07:29:11 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-06 09:04:31 -0700
commitfbd1a693c7343d4b37ae6d99b19f15d1293b77c2 (patch)
treee2c96bb1db5765adde2e1654b3eb22cd943d0a39 /refs.c
parentrefs: pass storage format to `ref_store_init()` explicitly (diff)
downloadgit-fbd1a693c7343d4b37ae6d99b19f15d1293b77c2.tar.gz
git-fbd1a693c7343d4b37ae6d99b19f15d1293b77c2.zip
refs: allow to skip creation of reflog entries
The ref backends do not have any way to disable the creation of reflog entries. This will be required for upcoming ref format migration logic so that we do not create any entries that didn't exist in the original ref database. Provide a new `REF_SKIP_CREATE_REFLOG` flag that allows the caller to disable reflog entry creation. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 423684b8b8..fa3b0a82d4 100644
--- a/refs.c
+++ b/refs.c
@@ -1194,6 +1194,12 @@ int ref_transaction_update(struct ref_transaction *transaction,
{
assert(err);
+ if ((flags & REF_FORCE_CREATE_REFLOG) &&
+ (flags & REF_SKIP_CREATE_REFLOG)) {
+ strbuf_addstr(err, _("refusing to force and skip creation of reflog"));
+ return -1;
+ }
+
if (!(flags & REF_SKIP_REFNAME_VERIFICATION) &&
((new_oid && !is_null_oid(new_oid)) ?
check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) :