Blame list-objects-filter-options.h

Packit 4511e4
#ifndef LIST_OBJECTS_FILTER_OPTIONS_H
Packit 4511e4
#define LIST_OBJECTS_FILTER_OPTIONS_H
Packit 4511e4
Packit 4511e4
#include "parse-options.h"
Packit 4511e4
Packit 4511e4
/*
Packit 4511e4
 * The list of defined filters for list-objects.
Packit 4511e4
 */
Packit 4511e4
enum list_objects_filter_choice {
Packit 4511e4
	LOFC_DISABLED = 0,
Packit 4511e4
	LOFC_BLOB_NONE,
Packit 4511e4
	LOFC_BLOB_LIMIT,
Packit 4511e4
	LOFC_SPARSE_OID,
Packit 4511e4
	LOFC_SPARSE_PATH,
Packit 4511e4
	LOFC__COUNT /* must be last */
Packit 4511e4
};
Packit 4511e4
Packit 4511e4
struct list_objects_filter_options {
Packit 4511e4
	/*
Packit 4511e4
	 * 'filter_spec' is the raw argument value given on the command line
Packit 4511e4
	 * or protocol request.  (The part after the "--keyword=".)  For
Packit 4511e4
	 * commands that launch filtering sub-processes, this value should be
Packit 4511e4
	 * passed to them as received by the current process.
Packit 4511e4
	 */
Packit 4511e4
	char *filter_spec;
Packit 4511e4
Packit 4511e4
	/*
Packit 4511e4
	 * 'choice' is determined by parsing the filter-spec.  This indicates
Packit 4511e4
	 * the filtering algorithm to use.
Packit 4511e4
	 */
Packit 4511e4
	enum list_objects_filter_choice choice;
Packit 4511e4
Packit 4511e4
	/*
Packit 4511e4
	 * Choice is LOFC_DISABLED because "--no-filter" was requested.
Packit 4511e4
	 */
Packit 4511e4
	unsigned int no_filter : 1;
Packit 4511e4
Packit 4511e4
	/*
Packit 4511e4
	 * Parsed values (fields) from within the filter-spec.  These are
Packit 4511e4
	 * choice-specific; not all values will be defined for any given
Packit 4511e4
	 * choice.
Packit 4511e4
	 */
Packit 4511e4
	struct object_id *sparse_oid_value;
Packit 4511e4
	char *sparse_path_value;
Packit 4511e4
	unsigned long blob_limit_value;
Packit 4511e4
};
Packit 4511e4
Packit 4511e4
/* Normalized command line arguments */
Packit 4511e4
#define CL_ARG__FILTER "filter"
Packit 4511e4
Packit 4511e4
int parse_list_objects_filter(
Packit 4511e4
	struct list_objects_filter_options *filter_options,
Packit 4511e4
	const char *arg);
Packit 4511e4
Packit 4511e4
int opt_parse_list_objects_filter(const struct option *opt,
Packit 4511e4
				  const char *arg, int unset);
Packit 4511e4
Packit 4511e4
#define OPT_PARSE_LIST_OBJECTS_FILTER(fo) \
Packit 4511e4
	{ OPTION_CALLBACK, 0, CL_ARG__FILTER, fo, N_("args"), \
Packit 4511e4
	  N_("object filtering"), 0, \
Packit 4511e4
	  opt_parse_list_objects_filter }
Packit 4511e4
Packit 4511e4
void list_objects_filter_release(
Packit 4511e4
	struct list_objects_filter_options *filter_options);
Packit 4511e4
Packit 4511e4
static inline void list_objects_filter_set_no_filter(
Packit 4511e4
	struct list_objects_filter_options *filter_options)
Packit 4511e4
{
Packit 4511e4
	list_objects_filter_release(filter_options);
Packit 4511e4
	filter_options->no_filter = 1;
Packit 4511e4
}
Packit 4511e4
Packit 4511e4
void partial_clone_register(
Packit 4511e4
	const char *remote,
Packit 4511e4
	const struct list_objects_filter_options *filter_options);
Packit 4511e4
void partial_clone_get_default_filter_spec(
Packit 4511e4
	struct list_objects_filter_options *filter_options);
Packit 4511e4
Packit 4511e4
#endif /* LIST_OBJECTS_FILTER_OPTIONS_H */