summary refs log tree commit diff
path: root/list-objects-filter-options.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-08-11 18:04:12 -0700
committerJunio C Hamano <gitster@pobox.com>2020-08-11 18:04:13 -0700
commit73a925516604df7a95ad69b8d650275eb4ab270f (patch)
tree2789493d2cf88c7425b3d975d6e534321a705982 /list-objects-filter-options.c
parenta3afa4becd9368e5518b7a9a5fa06b099d257be1 (diff)
parent6cc275ea56e21537f480443fc8fd36f34c8b92cd (diff)
Merge branch 'tb/upload-pack-filters'
The component to respond to "git fetch" request is made more
configurable to selectively allow or reject object filtering
specification used for partial cloning.

* tb/upload-pack-filters:
  t5616: use test_i18ngrep for upload-pack errors
  upload-pack.c: introduce 'uploadpackfilter.tree.maxDepth'
  upload-pack.c: allow banning certain object filter(s)
  list_objects_filter_options: introduce 'list_object_filter_config_name'
Diffstat (limited to 'list-objects-filter-options.c')
-rw-r--r--list-objects-filter-options.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 3667766f29..b66314560a 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -15,6 +15,29 @@ static int parse_combine_filter(
 	const char *arg,
 	struct strbuf *errbuf);
 
+const char *list_object_filter_config_name(enum list_objects_filter_choice c)
+{
+	switch (c) {
+	case LOFC_DISABLED:
+		/* we have no name for "no filter at all" */
+		break;
+	case LOFC_BLOB_NONE:
+		return "blob:none";
+	case LOFC_BLOB_LIMIT:
+		return "blob:limit";
+	case LOFC_TREE_DEPTH:
+		return "tree";
+	case LOFC_SPARSE_OID:
+		return "sparse:oid";
+	case LOFC_COMBINE:
+		return "combine";
+	case LOFC__COUNT:
+		/* not a real filter type; just the count of all filters */
+		break;
+	}
+	BUG("list_object_filter_choice_name: invalid argument '%d'", c);
+}
+
 /*
  * Parse value of the argument to the "filter" keyword.
  * On the command line this looks like: