aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-10-18 14:18:58 +0900
committerJunio C Hamano <gitster@pobox.com>2017-10-18 14:18:59 +0900
commit0f213754f6db9c005d881c13a858901e6d40ccb0 (patch)
treeab952b2cfeea72f2a57dc68fa887ce275794c2e7
parent550e41c43733a3dd35a53365a6509c28cbb3906a (diff)
parentc788c54cde5f7d52e4db9d4971545c3b2456ddcf (diff)
downloadgit-0f213754f6db9c005d881c13a858901e6d40ccb0.tar.gz
git-0f213754f6db9c005d881c13a858901e6d40ccb0.tar.xz
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
-rw-r--r--refs.c2
-rw-r--r--refs.h8
2 files changed, 10 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index ea2b9f84f..41aec6505 100644
--- a/refs.c
+++ b/refs.c
@@ -921,6 +921,8 @@ int ref_transaction_update(struct ref_transaction *transaction,
return -1;
}
+ flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
+
flags |= (new_sha1 ? REF_HAVE_NEW : 0) | (old_sha1 ? REF_HAVE_OLD : 0);
ref_transaction_add_update(transaction, refname, flags,
diff --git a/refs.h b/refs.h
index 6daa78eb5..4d75c207e 100644
--- a/refs.h
+++ b/refs.h
@@ -355,6 +355,14 @@ int refs_pack_refs(struct ref_store *refs, unsigned int flags);
#define REF_FORCE_CREATE_REFLOG 0x40
/*
+ * Flags that can be passed in to ref_transaction_update
+ */
+#define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \
+ REF_ISPRUNING | \
+ REF_FORCE_CREATE_REFLOG | \
+ REF_NODEREF
+
+/*
* Setup reflog before using. Fill in err and return -1 on failure.
*/
int refs_create_reflog(struct ref_store *refs, const char *refname,