From e9706a188f8598ea4d8afac1f70360abb77d4d8d Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 7 Dec 2021 13:38:17 +0000 Subject: refs: introduce REF_SKIP_OID_VERIFICATION flag This lets the ref-store test helper write non-existent or unparsable objects into the ref storage. Use this to make t1006 and t3800 independent of the files storage backend. Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- refs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'refs.h') diff --git a/refs.h b/refs.h index 45c34e99e3..76efc589cc 100644 --- a/refs.h +++ b/refs.h @@ -615,12 +615,18 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err); */ #define REF_FORCE_CREATE_REFLOG (1 << 1) +/* + * Blindly write an object_id. This is useful for testing data corruption + * scenarios. + */ +#define REF_SKIP_OID_VERIFICATION (1 << 10) + /* * Bitmask of all of the flags that are allowed to be passed in to * ref_transaction_update() and friends: */ #define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \ - (REF_NO_DEREF | REF_FORCE_CREATE_REFLOG) + (REF_NO_DEREF | REF_FORCE_CREATE_REFLOG | REF_SKIP_OID_VERIFICATION) /* * Add a reference update to transaction. `new_oid` is the value that -- cgit v1.2.3 From 3c966c7b4e97a5399662f85ab73af08a6419a303 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 7 Dec 2021 13:38:18 +0000 Subject: refs: introduce REF_SKIP_REFNAME_VERIFICATION flag Use this flag with the test-helper in t1430, to avoid direct writes to the ref database. Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- refs.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'refs.h') diff --git a/refs.h b/refs.h index 76efc589cc..65017ceaef 100644 --- a/refs.h +++ b/refs.h @@ -621,12 +621,18 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err); */ #define REF_SKIP_OID_VERIFICATION (1 << 10) +/* + * Skip verifying refname. This is useful for testing data corruption scenarios. + */ +#define REF_SKIP_REFNAME_VERIFICATION (1 << 11) + /* * Bitmask of all of the flags that are allowed to be passed in to * ref_transaction_update() and friends: */ -#define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \ - (REF_NO_DEREF | REF_FORCE_CREATE_REFLOG | REF_SKIP_OID_VERIFICATION) +#define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \ + (REF_NO_DEREF | REF_FORCE_CREATE_REFLOG | REF_SKIP_OID_VERIFICATION | \ + REF_SKIP_REFNAME_VERIFICATION) /* * Add a reference update to transaction. `new_oid` is the value that -- cgit v1.2.3