Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2021-10-07 23:25:12 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-08 20:45:48 +0300
commitacb533440fc0ed32e195987b9946e948a9706560 (patch)
tree5d15160dab669d0e7ddcf1b07cee068816b0eaae /reftable/refname.h
parent1ae2b8cda84c4c662d8f60898e034d9643f097b6 (diff)
reftable: implement refname validation
The packed/loose format has restrictions on refnames: a and a/b cannot coexist. This limitation does not apply to reftable per se, but must be maintained for interoperability. This code adds validation routines to abort transactions that are trying to add invalid names. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/refname.h')
-rw-r--r--reftable/refname.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/reftable/refname.h b/reftable/refname.h
new file mode 100644
index 0000000000..a24b40fcb4
--- /dev/null
+++ b/reftable/refname.h
@@ -0,0 +1,29 @@
+/*
+ Copyright 2020 Google LLC
+
+ Use of this source code is governed by a BSD-style
+ license that can be found in the LICENSE file or at
+ https://developers.google.com/open-source/licenses/bsd
+*/
+#ifndef REFNAME_H
+#define REFNAME_H
+
+#include "reftable-record.h"
+#include "reftable-generic.h"
+
+struct modification {
+ struct reftable_table tab;
+
+ char **add;
+ size_t add_len;
+
+ char **del;
+ size_t del_len;
+};
+
+int validate_ref_record_addition(struct reftable_table tab,
+ struct reftable_ref_record *recs, size_t sz);
+
+int modification_validate(struct modification *mod);
+
+#endif