#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"
#include "gettext.h"
#include "environment.h"
#include "hex.h"
#include "refs.h"
#include "refspec.h"
#include "object-name.h"
#include "object-store-ll.h"
#include "oidset.h"
#include "oid-array.h"
#include "commit.h"
#include "string-list.h"
#include "remote.h"
#include "transport.h"
#include "run-command.h"
#include "parse-options.h"
#include "sigchain.h"
#include "submodule-config.h"
#include "submodule.h"
#include "connected.h"
#include "strvec.h"
#include "utf8.h"
#include "pager.h"
#include "path.h"
#include "pkt-line.h"
#include "list-objects-filter-options.h"
#include "commit-reach.h"
#include "branch.h"
#include "promisor-remote.h"
#include "commit-graph.h"
#include "shallow.h"
#include "trace.h"
#include "trace2.h"
#include "bundle-uri.h"
#define FORCED_UPDATES_DELAY_WARNING_IN_MS …
static const char * const builtin_fetch_usage[] = …;
enum { … };
enum display_format { … };
struct display_state { … };
static uint64_t forced_updates_ms = …;
static int prefetch = …;
static int prune = …;
#define PRUNE_BY_DEFAULT …
static int prune_tags = …;
#define PRUNE_TAGS_BY_DEFAULT …
static int append, dry_run, force, keep, update_head_ok;
static int write_fetch_head = …;
static int verbosity, deepen_relative, set_upstream, refetch;
static int progress = …;
static int tags = …, update_shallow, deepen;
static int atomic_fetch;
static enum transport_family family;
static const char *depth;
static const char *deepen_since;
static const char *upload_pack;
static struct string_list deepen_not = …;
static struct strbuf default_rla = …;
static struct transport *gtransport;
static struct transport *gsecondary;
static struct refspec refmap = …;
static struct list_objects_filter_options filter_options = …;
static struct string_list server_options = …;
static struct string_list negotiation_tip = …;
struct fetch_config { … };
static int git_fetch_config(const char *k, const char *v,
const struct config_context *ctx, void *cb)
{ … }
static int parse_refmap_arg(const struct option *opt, const char *arg, int unset)
{ … }
static void unlock_pack(unsigned int flags)
{ … }
static void unlock_pack_atexit(void)
{ … }
static void unlock_pack_on_signal(int signo)
{ … }
static void add_merge_config(struct ref **head,
const struct ref *remote_refs,
struct branch *branch,
struct ref ***tail)
{ … }
static void create_fetch_oidset(struct ref **head, struct oidset *out)
{ … }
struct refname_hash_entry { … };
static int refname_hash_entry_cmp(const void *hashmap_cmp_fn_data UNUSED,
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
{ … }
static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
const char *refname,
const struct object_id *oid)
{ … }
static int add_one_refname(const char *refname, const char *referent UNUSED,
const struct object_id *oid,
int flag UNUSED, void *cbdata)
{ … }
static void refname_hash_init(struct hashmap *map)
{ … }
static int refname_hash_exists(struct hashmap *map, const char *refname)
{ … }
static void clear_item(struct refname_hash_entry *item)
{ … }
static void add_already_queued_tags(const char *refname,
const struct object_id *old_oid UNUSED,
const struct object_id *new_oid,
void *cb_data)
{ … }
static void find_non_local_tags(const struct ref *refs,
struct ref_transaction *transaction,
struct ref **head,
struct ref ***tail)
{ … }
static void filter_prefetch_refspec(struct refspec *rs)
{ … }
static struct ref *get_ref_map(struct remote *remote,
const struct ref *remote_refs,
struct refspec *rs,
int tags, int *autotags)
{ … }
#define STORE_REF_ERROR_OTHER …
#define STORE_REF_ERROR_DF_CONFLICT …
static int s_update_ref(const char *action,
struct ref *ref,
struct ref_transaction *transaction,
int check_old)
{ … }
static int refcol_width(const struct ref *ref_map, int compact_format)
{ … }
static void display_state_init(struct display_state *display_state, struct ref *ref_map,
const char *raw_url, enum display_format format)
{ … }
static void display_state_release(struct display_state *display_state)
{ … }
static void print_remote_to_local(struct display_state *display_state,
const char *remote, const char *local)
{ … }
static int find_and_replace(struct strbuf *haystack,
const char *needle,
const char *placeholder)
{ … }
static void print_compact(struct display_state *display_state,
const char *remote, const char *local)
{ … }
static void display_ref_update(struct display_state *display_state, char code,
const char *summary, const char *error,
const char *remote, const char *local,
const struct object_id *old_oid,
const struct object_id *new_oid,
int summary_width)
{ … }
static int update_local_ref(struct ref *ref,
struct ref_transaction *transaction,
struct display_state *display_state,
const struct ref *remote_ref,
int summary_width,
const struct fetch_config *config)
{ … }
static const struct object_id *iterate_ref_map(void *cb_data)
{ … }
struct fetch_head { … };
static int open_fetch_head(struct fetch_head *fetch_head)
{ … }
static void append_fetch_head(struct fetch_head *fetch_head,
const struct object_id *old_oid,
enum fetch_head_status fetch_head_status,
const char *note,
const char *url, size_t url_len)
{ … }
static void commit_fetch_head(struct fetch_head *fetch_head)
{ … }
static void close_fetch_head(struct fetch_head *fetch_head)
{ … }
static const char warn_show_forced_updates[] = …);
static const char warn_time_show_forced_updates[] = …);
static int store_updated_refs(struct display_state *display_state,
const char *remote_name,
int connectivity_checked,
struct ref_transaction *transaction, struct ref *ref_map,
struct fetch_head *fetch_head,
const struct fetch_config *config)
{ … }
static int check_exist_and_connected(struct ref *ref_map)
{ … }
static int fetch_and_consume_refs(struct display_state *display_state,
struct transport *transport,
struct ref_transaction *transaction,
struct ref *ref_map,
struct fetch_head *fetch_head,
const struct fetch_config *config)
{ … }
static int prune_refs(struct display_state *display_state,
struct refspec *rs,
struct ref_transaction *transaction,
struct ref *ref_map)
{ … }
static void check_not_current_branch(struct ref *ref_map)
{ … }
static int truncate_fetch_head(void)
{ … }
static void set_option(struct transport *transport, const char *name, const char *value)
{ … }
static int add_oid(const char *refname UNUSED,
const char *referent UNUSED,
const struct object_id *oid,
int flags UNUSED, void *cb_data)
{ … }
static void add_negotiation_tips(struct git_transport_options *smart_options)
{ … }
static struct transport *prepare_transport(struct remote *remote, int deepen)
{ … }
static int backfill_tags(struct display_state *display_state,
struct transport *transport,
struct ref_transaction *transaction,
struct ref *ref_map,
struct fetch_head *fetch_head,
const struct fetch_config *config)
{ … }
static int do_fetch(struct transport *transport,
struct refspec *rs,
const struct fetch_config *config)
{ … }
static int get_one_remote_for_fetch(struct remote *remote, void *priv)
{ … }
struct remote_group_data { … };
static int get_remote_group(const char *key, const char *value,
const struct config_context *ctx UNUSED,
void *priv)
{ … }
static int add_remote_or_group(const char *name, struct string_list *list)
{ … }
static void add_options_to_argv(struct strvec *argv,
const struct fetch_config *config)
{ … }
struct parallel_fetch_state { … };
static int fetch_next_remote(struct child_process *cp,
struct strbuf *out UNUSED,
void *cb, void **task_cb)
{ … }
static int fetch_failed_to_start(struct strbuf *out UNUSED,
void *cb, void *task_cb)
{ … }
static int fetch_finished(int result, struct strbuf *out,
void *cb, void *task_cb)
{ … }
static int fetch_multiple(struct string_list *list, int max_children,
const struct fetch_config *config)
{ … }
static inline void fetch_one_setup_partial(struct remote *remote)
{ … }
static int fetch_one(struct remote *remote, int argc, const char **argv,
int prune_tags_ok, int use_stdin_refspecs,
const struct fetch_config *config)
{ … }
int cmd_fetch(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{ … }