summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-11-05 09:42:03 +0100
committerJunio C Hamano <gitster@pobox.com>2017-11-06 10:31:07 +0900
commita9bbbcec0d863d719dd4ae39fc2242b32c2008e7 (patch)
tree6022a8162d7e4d78167a36a5c8bec4454aff2ce9 /refs.c
parentb00f3cfa92d10d7180e6baf01d570eb904b5a592 (diff)
downloadgit-a9bbbcec0d863d719dd4ae39fc2242b32c2008e7.tar.gz
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 62a7621025..7c1e206e08 100644
--- a/refs.c
+++ b/refs.c
@@ -940,7 +940,8 @@ int ref_transaction_update(struct ref_transaction *transaction,
return -1;
}
- flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
+ if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
+ BUG("illegal flags 0x%x passed to ref_transaction_update()", flags);
flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);