ref_transaction_update(): die on disallowed flags
Callers shouldn't be passing disallowed flags into `ref_transaction_update()`. So instead of masking them off, treat it as a bug if any are set. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Nov 5, 2017 at 09:42 UTC
a9bbbcec0d863d719dd4ae39fc2242b32c2008e7
1 file changed
+2
-1
refs.c
+2
-1
@@ -940,7 +940,8 @@ int ref_transaction_update(struct ref_transaction *transaction,
940
return -1;
941
}
942
943
- flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
943
+ if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
944
+ BUG("illegal flags 0x%x passed to ref_transaction_update()", flags);
945
946
flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);
947