git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
4af89c4c86bee0707fc3ff63a9124b84eb54b70b blob 5499 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
 
#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;

	/*
	 * 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 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 */
int 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 */
int 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);

/* Search for atom "rest" in given format. */
int is_rest_atom_used(const struct ref_format *format);

#endif /*  REF_FILTER_H  */
debug log:

solving 4af89c4c86bee ...
found 4af89c4c86bee in https://public-inbox.org/git/0102016133ff3b41-c77d5053-8546-4b12-831e-135f3025a2ea-000000@eu-west-1.amazonses.com/
found 276de387f3bd0 in https://public-inbox.org/git/0102016133ff3b3d-58cb3635-e54a-4473-a12c-78351f613c2c-000000@eu-west-1.amazonses.com/
found c848370bed84a in https://public-inbox.org/git/0102016133ff3b3b-a0ab669e-bc4b-4a25-ac66-5365c56856b1-000000@eu-west-1.amazonses.com/
found e41d2913c0fff in https://public-inbox.org/git/0102016133ff3b1b-dcaaf82b-b21b-49b9-b21c-85f55873bd09-000000@eu-west-1.amazonses.com/
found 6373167aaacd7 in https://public-inbox.org/git/0102016133ff3b05-802b1468-13cf-453f-801f-d5530f2f94ac-000000@eu-west-1.amazonses.com/
found 7aaf82799ec2d in https://public-inbox.org/git/0102016133ff3b28-9969f573-5976-45d9-a51a-4edba26d95c2-000000@eu-west-1.amazonses.com/
found b50c8e6aaf2c4 in https://public-inbox.org/git/0102016133ff3b0a-d7e5bf0c-4d99-41e4-882b-47a875c528fb-000000@eu-west-1.amazonses.com/
found 56093a85d52b8 in https://public-inbox.org/git/0102016133ff3b0c-042864ef-1f19-4991-a240-7358c56daec9-000000@eu-west-1.amazonses.com/
found ff416b733b4b1 in https://public-inbox.org/git/0102016133ff3ad8-abf99952-4df0-42a4-9ae9-06f602e84f3b-000000@eu-west-1.amazonses.com/
found 0d98342b34319 in git.git.git
preparing index
index prepared:
100644 0d98342b343196387c0f4e2dcd5978a9361d8edb	ref-filter.h

applying [1/9] https://public-inbox.org/git/0102016133ff3ad8-abf99952-4df0-42a4-9ae9-06f602e84f3b-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 0d98342b34319..ff416b733b4b1 100644


applying [2/9] https://public-inbox.org/git/0102016133ff3b0c-042864ef-1f19-4991-a240-7358c56daec9-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index ff416b733b4b1..56093a85d52b8 100644


applying [3/9] https://public-inbox.org/git/0102016133ff3b0a-d7e5bf0c-4d99-41e4-882b-47a875c528fb-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 56093a85d52b8..b50c8e6aaf2c4 100644


applying [4/9] https://public-inbox.org/git/0102016133ff3b28-9969f573-5976-45d9-a51a-4edba26d95c2-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index b50c8e6aaf2c4..7aaf82799ec2d 100644


applying [5/9] https://public-inbox.org/git/0102016133ff3b05-802b1468-13cf-453f-801f-d5530f2f94ac-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 7aaf82799ec2d..6373167aaacd7 100644


applying [6/9] https://public-inbox.org/git/0102016133ff3b1b-dcaaf82b-b21b-49b9-b21c-85f55873bd09-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 6373167aaacd7..e41d2913c0fff 100644


applying [7/9] https://public-inbox.org/git/0102016133ff3b3b-a0ab669e-bc4b-4a25-ac66-5365c56856b1-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index e41d2913c0fff..c848370bed84a 100644


applying [8/9] https://public-inbox.org/git/0102016133ff3b3d-58cb3635-e54a-4473-a12c-78351f613c2c-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index c848370bed84a..276de387f3bd0 100644


applying [9/9] https://public-inbox.org/git/0102016133ff3b41-c77d5053-8546-4b12-831e-135f3025a2ea-000000@eu-west-1.amazonses.com/
diff --git a/ref-filter.h b/ref-filter.h
index 276de387f3bd0..4af89c4c86bee 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.
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 4af89c4c86bee0707fc3ff63a9124b84eb54b70b	ref-filter.h

Code repositories for project(s) associated with this 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).