#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "environment.h"
#include "gettext.h"
#include "config.h"
#include "gpg-interface.h"
#include "hex.h"
#include "parse-options.h"
#include "run-command.h"
#include "refs.h"
#include "wildmatch.h"
#include "object-name.h"
#include "object-store-ll.h"
#include "oid-array.h"
#include "repo-settings.h"
#include "repository.h"
#include "commit.h"
#include "mailmap.h"
#include "ident.h"
#include "remote.h"
#include "color.h"
#include "tag.h"
#include "quote.h"
#include "ref-filter.h"
#include "revision.h"
#include "utf8.h"
#include "versioncmp.h"
#include "trailer.h"
#include "wt-status.h"
#include "commit-slab.h"
#include "commit-reach.h"
#include "worktree.h"
#include "hashmap.h"
static struct ref_msg { … } msgs = …;
void setup_ref_filter_porcelain_msg(void)
{ … }
cmp_type;
cmp_status;
info_source;
struct align { … };
struct if_then_else { … };
struct refname_atom { … };
struct ref_trailer_buf { … };
static struct expand_data { … } oi, oi_deref;
struct ref_to_worktree_entry { … };
static int ref_to_worktree_map_cmpfnc(const void *lookupdata UNUSED,
const struct hashmap_entry *eptr,
const struct hashmap_entry *kptr,
const void *keydata_aka_refname)
{ … }
static struct ref_to_worktree_map { … } ref_to_worktree_map;
enum atom_type { … };
static struct used_atom { … } *used_atom;
static int used_atom_cnt, need_tagged, need_symref;
__attribute__((format (printf, 3, 4)))
static int strbuf_addf_ret(struct strbuf *sb, int ret, const char *fmt, ...)
{ … }
static int err_no_arg(struct strbuf *sb, const char *name)
{ … }
static int err_bad_arg(struct strbuf *sb, const char *name, const char *arg)
{ … }
static int match_atom_arg_value(const char *to_parse, const char *candidate,
const char **end, const char **valuestart,
size_t *valuelen)
{ … }
static int match_atom_bool_arg(const char *to_parse, const char *candidate,
const char **end, int *val)
{ … }
static int color_atom_parser(struct ref_format *format, struct used_atom *atom,
const char *color_value, struct strbuf *err)
{ … }
static int refname_atom_parser_internal(struct refname_atom *atom, const char *arg,
const char *name, struct strbuf *err)
{ … }
static int remote_ref_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int objecttype_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int objectsize_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int deltabase_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int body_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int subject_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int parse_signature_option(const char *arg)
{ … }
static int signature_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int trailers_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int contents_atom_parser(struct ref_format *format, struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int describe_atom_option_parser(struct strvec *args, const char **arg,
struct strbuf *err)
{ … }
static int describe_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int raw_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int oid_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int person_name_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int email_atom_option_parser(const char **arg)
{ … }
static int person_email_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int refname_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static align_type parse_align_position(const char *s)
{ … }
static int align_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int if_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static int rest_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom UNUSED,
const char *arg, struct strbuf *err)
{ … }
static int ahead_behind_atom_parser(struct ref_format *format,
struct used_atom *atom UNUSED,
const char *arg, struct strbuf *err)
{ … }
static int is_base_atom_parser(struct ref_format *format,
struct used_atom *atom UNUSED,
const char *arg, struct strbuf *err)
{ … }
static int head_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{ … }
static struct { … } valid_atom[] = …;
#define REF_FORMATTING_STATE_INIT …
struct ref_formatting_stack { … };
struct ref_formatting_state { … };
struct atom_value { … };
#define ATOM_SIZE_UNSPECIFIED …
#define ATOM_VALUE_INIT …
static int parse_ref_filter_atom(struct ref_format *format,
const char *atom, const char *ep,
struct strbuf *err)
{ … }
static void quote_formatting(struct strbuf *s, const char *str, ssize_t len, int quote_style)
{ … }
static int append_atom(struct atom_value *v, struct ref_formatting_state *state,
struct strbuf *err UNUSED)
{ … }
static void push_stack_element(struct ref_formatting_stack **stack)
{ … }
static void pop_stack_element(struct ref_formatting_stack **stack)
{ … }
static void end_align_handler(struct ref_formatting_stack **stack)
{ … }
static int align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
struct strbuf *err UNUSED)
{ … }
static void if_then_else_handler(struct ref_formatting_stack **stack)
{ … }
static int if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
struct strbuf *err UNUSED)
{ … }
static int is_empty(struct strbuf *buf)
{ … }
static int then_atom_handler(struct atom_value *atomv UNUSED,
struct ref_formatting_state *state,
struct strbuf *err)
{ … }
static int else_atom_handler(struct atom_value *atomv UNUSED,
struct ref_formatting_state *state,
struct strbuf *err)
{ … }
static int end_atom_handler(struct atom_value *atomv UNUSED,
struct ref_formatting_state *state,
struct strbuf *err)
{ … }
static const char *find_next(const char *cp)
{ … }
static int reject_atom(enum atom_type atom_type)
{ … }
int verify_ref_format(struct ref_format *format)
{ … }
static const char *do_grab_oid(const char *field, const struct object_id *oid,
struct used_atom *atom)
{ … }
static int grab_oid(const char *name, const char *field, const struct object_id *oid,
struct atom_value *v, struct used_atom *atom)
{ … }
static void grab_common_values(struct atom_value *val, int deref, struct expand_data *oi)
{ … }
static void grab_tag_values(struct atom_value *val, int deref, struct object *obj)
{ … }
static void grab_commit_values(struct atom_value *val, int deref, struct object *obj)
{ … }
static const char *find_wholine(const char *who, int wholen, const char *buf)
{ … }
static const char *copy_line(const char *buf)
{ … }
static const char *copy_name(const char *buf)
{ … }
static const char *find_end_of_email(const char *email, int opt)
{ … }
static const char *copy_email(const char *buf, struct used_atom *atom)
{ … }
static char *copy_subject(const char *buf, unsigned long len)
{ … }
static void grab_date(const char *buf, struct atom_value *v, const char *atomname)
{ … }
static struct string_list mailmap = …;
static void grab_person(const char *who, struct atom_value *val, int deref, void *buf)
{ … }
static void grab_signature(struct atom_value *val, int deref, struct object *obj)
{ … }
static void find_subpos(const char *buf,
const char **sub, size_t *sublen,
const char **body, size_t *bodylen,
size_t *nonsiglen,
const char **sig, size_t *siglen)
{ … }
static void append_lines(struct strbuf *out, const char *buf, unsigned long size, int lines)
{ … }
static void grab_describe_values(struct atom_value *val, int deref,
struct object *obj)
{ … }
static void grab_sub_body_contents(struct atom_value *val, int deref, struct expand_data *data)
{ … }
static void fill_missing_values(struct atom_value *val)
{ … }
static void grab_values(struct atom_value *val, int deref, struct object *obj, struct expand_data *data)
{ … }
static inline char *copy_advance(char *dst, const char *src)
{ … }
static const char *lstrip_ref_components(const char *refname, int len)
{ … }
static const char *rstrip_ref_components(const char *refname, int len)
{ … }
static const char *show_ref(struct refname_atom *atom, const char *refname)
{ … }
static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
struct branch *branch, const char **s)
{ … }
char *get_head_description(void)
{ … }
static const char *get_symref(struct used_atom *atom, struct ref_array_item *ref)
{ … }
static const char *get_refname(struct used_atom *atom, struct ref_array_item *ref)
{ … }
static int get_object(struct ref_array_item *ref, int deref, struct object **obj,
struct expand_data *oi, struct strbuf *err)
{ … }
static void populate_worktree_map(struct hashmap *map, struct worktree **worktrees)
{ … }
static void lazy_init_worktree_map(void)
{ … }
static char *get_worktree_path(const struct ref_array_item *ref)
{ … }
static int populate_value(struct ref_array_item *ref, struct strbuf *err)
{ … }
static int get_ref_atom_value(struct ref_array_item *ref, int atom,
struct atom_value **v, struct strbuf *err)
{ … }
static int match_pattern(const char **patterns, const char *refname,
int ignore_case)
{ … }
static int match_name_as_path(const char **pattern, const char *refname,
int ignore_case)
{ … }
static int filter_pattern_match(struct ref_filter *filter, const char *refname)
{ … }
static int filter_exclude_match(struct ref_filter *filter, const char *refname)
{ … }
static int for_each_fullref_in_pattern(struct ref_filter *filter,
each_ref_fn cb,
void *cb_data)
{ … }
static int match_points_at(struct oid_array *points_at,
const struct object_id *oid,
const char *refname)
{ … }
static struct ref_array_item *new_ref_array_item(const char *refname,
const struct object_id *oid)
{ … }
static void ref_array_append(struct ref_array *array, struct ref_array_item *ref)
{ … }
struct ref_array_item *ref_array_push(struct ref_array *array,
const char *refname,
const struct object_id *oid)
{ … }
static int ref_kind_from_refname(const char *refname)
{ … }
static int filter_ref_kind(struct ref_filter *filter, const char *refname)
{ … }
static struct ref_array_item *apply_ref_filter(const char *refname, const char *referent, const struct object_id *oid,
int flag, struct ref_filter *filter)
{ … }
struct ref_filter_cbdata { … };
static int filter_one(const char *refname, const char *referent, const struct object_id *oid, int flag, void *cb_data)
{ … }
static void free_array_item(struct ref_array_item *item)
{ … }
struct ref_filter_and_format_cbdata { … };
static int filter_and_format_one(const char *refname, const char *referent, const struct object_id *oid, int flag, void *cb_data)
{ … }
void ref_array_clear(struct ref_array *array)
{ … }
#define EXCLUDE_REACHED …
#define INCLUDE_REACHED …
static void reach_filter(struct ref_array *array,
struct commit_list **check_reachable,
int include_reached)
{ … }
void filter_ahead_behind(struct repository *r,
struct ref_format *format,
struct ref_array *array)
{ … }
void filter_is_base(struct repository *r,
struct ref_format *format,
struct ref_array *array)
{ … }
static int do_filter_refs(struct ref_filter *filter, unsigned int type, each_ref_fn fn, void *cb_data)
{ … }
int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int type)
{ … }
struct ref_sorting { … };
static inline int can_do_iterative_format(struct ref_filter *filter,
struct ref_sorting *sorting,
struct ref_format *format)
{ … }
void filter_and_format_refs(struct ref_filter *filter, unsigned int type,
struct ref_sorting *sorting,
struct ref_format *format)
{ … }
static int compare_detached_head(struct ref_array_item *a, struct ref_array_item *b)
{ … }
static int memcasecmp(const void *vs1, const void *vs2, size_t n)
{ … }
static int cmp_ref_sorting(struct ref_sorting *s, struct ref_array_item *a, struct ref_array_item *b)
{ … }
static int compare_refs(const void *a_, const void *b_, void *ref_sorting)
{ … }
void ref_sorting_set_sort_flags_all(struct ref_sorting *sorting,
unsigned int mask, int on)
{ … }
void ref_array_sort(struct ref_sorting *sorting, struct ref_array *array)
{ … }
static void append_literal(const char *cp, const char *ep, struct ref_formatting_state *state)
{ … }
int format_ref_array_item(struct ref_array_item *info,
struct ref_format *format,
struct strbuf *final_buf,
struct strbuf *error_buf)
{ … }
void print_formatted_ref_array(struct ref_array *array, struct ref_format *format)
{ … }
void pretty_print_ref(const char *name, const struct object_id *oid,
struct ref_format *format)
{ … }
static int parse_sorting_atom(const char *atom)
{ … }
static void parse_ref_sorting(struct ref_sorting **sorting_tail, const char *arg)
{ … }
struct ref_sorting *ref_sorting_options(struct string_list *options)
{ … }
void ref_sorting_release(struct ref_sorting *sorting)
{ … }
int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
{ … }
void ref_filter_init(struct ref_filter *filter)
{ … }
void ref_filter_clear(struct ref_filter *filter)
{ … }
void ref_format_init(struct ref_format *format)
{ … }
void ref_format_clear(struct ref_format *format)
{ … }