git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
e588d1f50eef6536b67531d835527cfa74552d93 blob 5644 bytes (raw)

  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
183
184
185
186
187
 
#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 *value;
	enum object_type type;
	unsigned long size;
	off_t disk_size;
	const char *rest;
	struct object_id delta_base_oid;
	/* Need it for better explanation in error log. */
	const char *start_of_request;
	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;
	int is_cat;
	int *split_on_whitespace;
	int all_objects;
};

#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 e588d1f50eef6 ...
found e588d1f50eef6 in https://public-inbox.org/git/01020160df6dc5cf-1aea868b-d09a-497a-904e-c282d89036f1-000000@eu-west-1.amazonses.com/
found aaf1790e43e62 in https://public-inbox.org/git/01020160df6dc5ba-269b8786-0038-41be-95b2-dee29fcde83f-000000@eu-west-1.amazonses.com/
found 12a938b0aa6a3 in https://public-inbox.org/git/01020160df6dc59f-522bf760-0897-4557-91dc-a5abb47d6215-000000@eu-west-1.amazonses.com/
found 0c7253913735b in https://public-inbox.org/git/01020160df6dc58b-a6cf8e70-3bde-461d-98af-5e5129973960-000000@eu-west-1.amazonses.com/
found 6df45c5bd9dcb in https://public-inbox.org/git/01020160df6dc587-aae8f2f1-48a8-4fdd-9917-0e5f4e62cf03-000000@eu-west-1.amazonses.com/
found 9bd36243481b4 in https://public-inbox.org/git/01020160df6dc583-8c4e2489-bbba-43d5-b2b8-48794531acea-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 git.git.git
preparing index
index prepared:
100644 0d98342b343196387c0f4e2dcd5978a9361d8edb	ref-filter.h

applying [1/12] 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/12] 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/12] 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/12] https://public-inbox.org/git/01020160df6dc583-8c4e2489-bbba-43d5-b2b8-48794531acea-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 590a60ffe034d..9bd36243481b4 100644


applying [5/12] https://public-inbox.org/git/01020160df6dc587-aae8f2f1-48a8-4fdd-9917-0e5f4e62cf03-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 9bd36243481b4..6df45c5bd9dcb 100644


applying [6/12] https://public-inbox.org/git/01020160df6dc58b-a6cf8e70-3bde-461d-98af-5e5129973960-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 6df45c5bd9dcb..0c7253913735b 100644


applying [7/12] https://public-inbox.org/git/01020160df6dc59f-522bf760-0897-4557-91dc-a5abb47d6215-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 0c7253913735b..12a938b0aa6a3 100644


applying [8/12] https://public-inbox.org/git/01020160df6dc5ba-269b8786-0038-41be-95b2-dee29fcde83f-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 12a938b0aa6a3..aaf1790e43e62 100644


applying [9/12] https://public-inbox.org/git/01020160df6dc5cf-1aea868b-d09a-497a-904e-c282d89036f1-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index aaf1790e43e62..e588d1f50eef6 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.
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 e588d1f50eef6536b67531d835527cfa74552d93	ref-filter.h

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git