git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob d541749f9b1dc04cff314cb1ce7476139b7abbc1 5504 bytes (raw)
name: ref-filter.h 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
 
#ifndef REF_FILTER_H
#define REF_FILTER_H

#include "sha1-array.h"
#include "refs.h"
#include "commit.h"
#include "parse-options.h"

/* Quoting styles */
#define QUOTE_NONE 0
#define QUOTE_SHELL 1
#define QUOTE_PERL 2
#define QUOTE_PYTHON 4
#define QUOTE_TCL 8

#define FILTER_REFS_INCLUDE_BROKEN 0x0001
#define FILTER_REFS_TAGS           0x0002
#define FILTER_REFS_BRANCHES       0x0004
#define FILTER_REFS_REMOTES        0x0008
#define FILTER_REFS_OTHERS         0x0010
#define FILTER_REFS_ALL            (FILTER_REFS_TAGS | FILTER_REFS_BRANCHES | \
				    FILTER_REFS_REMOTES | FILTER_REFS_OTHERS)
#define FILTER_REFS_DETACHED_HEAD  0x0020
#define FILTER_REFS_KIND_MASK      (FILTER_REFS_ALL | FILTER_REFS_DETACHED_HEAD)

struct atom_value;

struct ref_sorting {
	struct ref_sorting *next;
	int atom; /* index into used_atom array (internal) */
	unsigned reverse : 1,
		ignore_case : 1,
		version : 1;
};

struct ref_array_item {
	struct object_id objectname;
	int flag;
	unsigned int kind;
	const char *symref;
	struct commit *commit;
	struct atom_value *values;
	enum object_type type;
	unsigned long size;
	off_t disk_size;
	const char *rest;
	struct object_id delta_base_oid;
	char refname[FLEX_ARRAY];
};

struct ref_array {
	int nr, alloc;
	struct ref_array_item **items;
	struct rev_info *revs;
};

struct ref_filter {
	const char **name_patterns;
	struct oid_array points_at;
	struct commit_list *with_commit;
	struct commit_list *no_commit;

	enum {
		REF_FILTER_MERGED_NONE = 0,
		REF_FILTER_MERGED_INCLUDE,
		REF_FILTER_MERGED_OMIT
	} merge;
	struct commit *merge_commit;

	unsigned int with_commit_tag_algo : 1,
		match_as_path : 1,
		ignore_case : 1,
		detached : 1;
	unsigned int kind,
		lines;
	int abbrev,
		verbose;
};

struct expand_data {
	struct object_id oid;
	enum object_type type;
	unsigned long size;
	off_t disk_size;
	const char *rest;
	struct object_id delta_base_oid;

	/*
	 * Whether to split the input on whitespace before feeding it to
	 * get_sha1; this is decided during the mark_query phase based on
	 * whether we have a %(rest) token in our format.
	 */
	int split_on_whitespace;

	/*
	 * After a mark_query run, this object_info is set up to be
	 * passed to sha1_object_info_extended. It will point to the data
	 * elements above, so you can retrieve the response from there.
	 */
	struct object_info info;

	/*
	 * This flag will be true if the requested batch format and options
	 * don't require us to call sha1_object_info, which can then be
	 * optimized out.
	 */
	unsigned skip_object_info : 1;
};

struct ref_format {
	/*
	 * Set these to define the format; make sure you call
	 * verify_ref_format() afterwards to finalize.
	 */
	const char *format;
	int quote_style;
	int use_color;

	/* Internal state to ref-filter */
	int need_color_reset_at_eol;

	/*
	 * Helps to move all formatting logic from cat-file to ref-filter,
	 * hopefully would be reduced later.
	 */
	struct expand_data *cat_file_data;
};

#define REF_FORMAT_INIT { NULL, 0, -1 }

/*  Macros for checking --merged and --no-merged options */
#define _OPT_MERGED_NO_MERGED(option, filter, h) \
	{ OPTION_CALLBACK, 0, option, (filter), N_("commit"), (h), \
	  PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG, \
	  parse_opt_merge_filter, (intptr_t) "HEAD" \
	}
#define OPT_MERGED(f, h) _OPT_MERGED_NO_MERGED("merged", f, h)
#define OPT_NO_MERGED(f, h) _OPT_MERGED_NO_MERGED("no-merged", f, h)

/*
 * API for filtering a set of refs. Based on the type of refs the user
 * has requested, we iterate through those refs and apply filters
 * as per the given ref_filter structure and finally store the
 * filtered refs in the ref_array structure.
 */
int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int type);
/*  Clear all memory allocated to ref_array */
void ref_array_clear(struct ref_array *array);
/*  Used to verify if the given format is correct and to parse out the used atoms */
int verify_ref_format(struct ref_format *format);
/*  Sort the given ref_array as per the ref_sorting provided */
void ref_array_sort(struct ref_sorting *sort, struct ref_array *array);
/*  Based on the given format and quote_style, fill the strbuf */
void format_ref_array_item(struct ref_array_item *info,
			   const struct ref_format *format,
			   struct strbuf *final_buf);
/*  Print the ref using the given format and quote_style */
void show_ref_array_item(struct ref_array_item *info, const struct ref_format *format);
/*  Parse a single sort specifier and add it to the list */
void parse_ref_sorting(struct ref_sorting **sorting_tail, const char *atom);
/*  Callback function for parsing the sort option */
int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset);
/*  Default sort option based on refname */
struct ref_sorting *ref_default_sorting(void);
/*  Function to parse --merged and --no-merged options */
int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);
/*  Get the current HEAD's description */
char *get_head_description(void);
/*  Set up translated strings in the output. */
void setup_ref_filter_porcelain_msg(void);

/*
 * Print a single ref, outside of any ref-filter. Note that the
 * name must be a fully qualified refname.
 */
void pretty_print_ref(const char *name, const unsigned char *sha1,
		      const struct ref_format *format);

/* Fill the values of request and prepare all data for final string creation */
int populate_value(struct ref_array_item *ref);

#endif /*  REF_FILTER_H  */

debug log:

solving d541749f9b1dc ...
found d541749f9b1dc in https://public-inbox.org/git/01020160db067bda-4be1f1f1-22c8-45bf-983d-053ae428cb2d-000000@eu-west-1.amazonses.com/
found 28774e8e0f771 in https://public-inbox.org/git/01020160db067baa-645d1cd7-0fa5-404e-b3f0-afba7dac7d18-000000@eu-west-1.amazonses.com/
found de3fd3263ac64 in https://public-inbox.org/git/01020160db067af3-3108a276-f04a-4eb0-8434-5006f6596f56-000000@eu-west-1.amazonses.com/
found 590a60ffe034d in https://public-inbox.org/git/01020160db067add-6a32c398-0438-4bd1-8622-d3870adf9167-000000@eu-west-1.amazonses.com/ ||
	https://public-inbox.org/git/01020160df6dc54b-3776504b-c5b2-4139-8ade-e54b3213df19-000000@eu-west-1.amazonses.com/
found 97169548939cd in https://public-inbox.org/git/01020160df6dc537-9512602f-61a7-408f-a78a-289be6a96b93-000000@eu-west-1.amazonses.com/ ||
	https://public-inbox.org/git/01020160db067b66-c22a78cb-5297-426b-9b11-a20a8c27f74e-000000@eu-west-1.amazonses.com/
found 16d00e4b1bded in https://public-inbox.org/git/01020160db067ae4-79bd5ef7-3402-4333-93c1-c9ae8059680c-000000@eu-west-1.amazonses.com/ ||
	https://public-inbox.org/git/01020160df6dc532-75f3ef78-26cb-4751-9ded-eb0e8d23833b-000000@eu-west-1.amazonses.com/
found 0d98342b34319 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 0d98342b343196387c0f4e2dcd5978a9361d8edb	ref-filter.h

applying [1/6] https://public-inbox.org/git/01020160db067ae4-79bd5ef7-3402-4333-93c1-c9ae8059680c-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 0d98342b34319..16d00e4b1bded 100644

Checking patch ref-filter.h...
Applied patch ref-filter.h cleanly.

skipping https://public-inbox.org/git/01020160df6dc532-75f3ef78-26cb-4751-9ded-eb0e8d23833b-000000@eu-west-1.amazonses.com/ for 16d00e4b1bded
index at:
100644 16d00e4b1bded8b3ea5a7ccf430cbfab41488f83	ref-filter.h

applying [2/6] https://public-inbox.org/git/01020160df6dc537-9512602f-61a7-408f-a78a-289be6a96b93-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 16d00e4b1bded..97169548939cd 100644

Checking patch ref-filter.h...
Applied patch ref-filter.h cleanly.

skipping https://public-inbox.org/git/01020160db067b66-c22a78cb-5297-426b-9b11-a20a8c27f74e-000000@eu-west-1.amazonses.com/ for 97169548939cd
index at:
100644 97169548939cd6724dfd5278c7fe0440b563f3e1	ref-filter.h

applying [3/6] https://public-inbox.org/git/01020160db067add-6a32c398-0438-4bd1-8622-d3870adf9167-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 97169548939cd..590a60ffe034d 100644

Checking patch ref-filter.h...
Applied patch ref-filter.h cleanly.

skipping https://public-inbox.org/git/01020160df6dc54b-3776504b-c5b2-4139-8ade-e54b3213df19-000000@eu-west-1.amazonses.com/ for 590a60ffe034d
index at:
100644 590a60ffe034db11743c636257e97c9f7ce9601e	ref-filter.h

applying [4/6] https://public-inbox.org/git/01020160db067af3-3108a276-f04a-4eb0-8434-5006f6596f56-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 590a60ffe034d..de3fd3263ac64 100644


applying [5/6] https://public-inbox.org/git/01020160db067baa-645d1cd7-0fa5-404e-b3f0-afba7dac7d18-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index de3fd3263ac64..28774e8e0f771 100644


applying [6/6] https://public-inbox.org/git/01020160db067bda-4be1f1f1-22c8-45bf-983d-053ae428cb2d-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 28774e8e0f771..d541749f9b1dc 100644

Checking patch ref-filter.h...
Applied patch ref-filter.h cleanly.
Checking patch ref-filter.h...
Applied patch ref-filter.h cleanly.
Checking patch ref-filter.h...
Applied patch ref-filter.h cleanly.

index at:
100644 d541749f9b1dc04cff314cb1ce7476139b7abbc1	ref-filter.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).