Skip to content

Commit 0f21375

Browse files
committed
Merge branch 'tg/refs-allowed-flags' into maint
API error-proofing which happens to also squelch warnings from GCC. * tg/refs-allowed-flags: refs: strip out not allowed flags from ref_transaction_update
2 parents 550e41c + c788c54 commit 0f21375

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

refs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,8 @@ int ref_transaction_update(struct ref_transaction *transaction,
921921
return -1;
922922
}
923923

924+
flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
925+
924926
flags |= (new_sha1 ? REF_HAVE_NEW : 0) | (old_sha1 ? REF_HAVE_OLD : 0);
925927

926928
ref_transaction_add_update(transaction, refname, flags,

refs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,14 @@ int refs_pack_refs(struct ref_store *refs, unsigned int flags);
354354
#define REF_NODEREF 0x01
355355
#define REF_FORCE_CREATE_REFLOG 0x40
356356

357+
/*
358+
* Flags that can be passed in to ref_transaction_update
359+
*/
360+
#define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \
361+
REF_ISPRUNING | \
362+
REF_FORCE_CREATE_REFLOG | \
363+
REF_NODEREF
364+
357365
/*
358366
* Setup reflog before using. Fill in err and return -1 on failure.
359367
*/

0 commit comments

Comments
 (0)