#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
#include "pack.h"
#include "refs.h"
#include "pkt-line.h"
#include "sideband.h"
#include "run-command.h"
#include "hook.h"
#include "exec-cmd.h"
#include "commit.h"
#include "object.h"
#include "remote.h"
#include "connect.h"
#include "string-list.h"
#include "oid-array.h"
#include "connected.h"
#include "strvec.h"
#include "version.h"
#include "gpg-interface.h"
#include "sigchain.h"
#include "fsck.h"
#include "tmp-objdir.h"
#include "oidset.h"
#include "packfile.h"
#include "object-name.h"
#include "object-store-ll.h"
#include "path.h"
#include "protocol.h"
#include "commit-reach.h"
#include "server-info.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h"
#include "shallow.h"
#include "parse-options.h"
static const char * const receive_pack_usage[] = …;
enum deny_action { … };
static int deny_deletes;
static int deny_non_fast_forwards;
static enum deny_action deny_current_branch = …;
static enum deny_action deny_delete_current = …;
static int receive_fsck_objects = …;
static int transfer_fsck_objects = …;
static struct strbuf fsck_msg_types = …;
static int receive_unpack_limit = …;
static int transfer_unpack_limit = …;
static int advertise_atomic_push = …;
static int advertise_push_options;
static int advertise_sid;
static int unpack_limit = …;
static off_t max_input_size;
static int report_status;
static int report_status_v2;
static int use_sideband;
static int use_atomic;
static int use_push_options;
static int quiet;
static int prefer_ofs_delta = …;
static int auto_update_server_info;
static int auto_gc = …;
static int reject_thin;
static int stateless_rpc;
static const char *service_dir;
static const char *head_name;
static void *head_name_to_free;
static int sent_capabilities;
static int shallow_update;
static const char *alt_shallow_file;
static struct strbuf push_cert = …;
static struct object_id push_cert_oid;
static struct signature_check sigcheck;
static const char *push_cert_nonce;
static char *cert_nonce_seed;
static struct strvec hidden_refs = …;
static const char *NONCE_UNSOLICITED = …;
static const char *NONCE_BAD = …;
static const char *NONCE_MISSING = …;
static const char *NONCE_OK = …;
static const char *NONCE_SLOP = …;
static const char *nonce_status;
static long nonce_stamp_slop;
static timestamp_t nonce_stamp_slop_limit;
static struct ref_transaction *transaction;
static enum { … } use_keepalive;
static int keepalive_in_sec = …;
static struct tmp_objdir *tmp_objdir;
static struct proc_receive_ref { … } *proc_receive_ref;
static void proc_receive_ref_append(const char *prefix);
static enum deny_action parse_deny_action(const char *var, const char *value)
{ … }
static int receive_pack_config(const char *var, const char *value,
const struct config_context *ctx, void *cb)
{ … }
static void show_ref(const char *path, const struct object_id *oid)
{ … }
static int show_ref_cb(const char *path_full, const char *referent UNUSED, const struct object_id *oid,
int flag UNUSED, void *data)
{ … }
static void show_one_alternate_ref(const struct object_id *oid,
void *data)
{ … }
static void write_head_info(void)
{ … }
#define RUN_PROC_RECEIVE_SCHEDULED …
#define RUN_PROC_RECEIVE_RETURNED …
struct command { … };
static void proc_receive_ref_append(const char *prefix)
{ … }
static int proc_receive_ref_matches(struct command *cmd)
{ … }
static void report_message(const char *prefix, const char *err, va_list params)
{ … }
__attribute__((format (printf, 1, 2)))
static void rp_warning(const char *err, ...)
{ … }
__attribute__((format (printf, 1, 2)))
static void rp_error(const char *err, ...)
{ … }
static int copy_to_sideband(int in, int out UNUSED, void *arg UNUSED)
{ … }
static void hmac_hash(unsigned char *out,
const char *key_in, size_t key_len,
const char *text, size_t text_len)
{ … }
static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)
{ … }
static int constant_memequal(const char *a, const char *b, size_t n)
{ … }
static const char *check_nonce(const char *buf)
{ … }
static int check_cert_push_options(const struct string_list *push_options)
{ … }
static void prepare_push_cert_sha1(struct child_process *proc)
{ … }
struct receive_hook_feed_state { … };
feed_fn;
static int run_and_feed_hook(const char *hook_name, feed_fn feed,
struct receive_hook_feed_state *feed_state)
{ … }
static int feed_receive_hook(void *state_, const char **bufp, size_t *sizep)
{ … }
static int run_receive_hook(struct command *commands,
const char *hook_name,
int skip_broken,
const struct string_list *push_options)
{ … }
static int run_update_hook(struct command *cmd)
{ … }
static struct command *find_command_by_refname(struct command *list,
const char *refname)
{ … }
static int read_proc_receive_report(struct packet_reader *reader,
struct command *commands,
struct strbuf *errmsg)
{ … }
static int run_proc_receive_hook(struct command *commands,
const struct string_list *push_options)
{ … }
static const char *refuse_unconfigured_deny_msg = …);
static void refuse_unconfigured_deny(void)
{ … }
static const char *refuse_unconfigured_deny_delete_current_msg = …);
static void refuse_unconfigured_deny_delete_current(void)
{ … }
static const struct object_id *command_singleton_iterator(void *cb_data);
static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
{ … }
static int head_has_history(void)
{ … }
static const char *push_to_deploy(unsigned char *sha1,
struct strvec *env,
const char *work_tree)
{ … }
static const char *push_to_checkout_hook = …;
static const char *push_to_checkout(unsigned char *hash,
int *invoked_hook,
struct strvec *env,
const char *work_tree)
{ … }
static const char *update_worktree(unsigned char *sha1, const struct worktree *worktree)
{ … }
static const char *update(struct command *cmd, struct shallow_info *si)
{ … }
static void run_update_post_hook(struct command *commands)
{ … }
static void check_aliased_update_internal(struct command *cmd,
struct string_list *list,
const char *dst_name, int flag)
{ … }
static void check_aliased_update(struct command *cmd, struct string_list *list)
{ … }
static void check_aliased_updates(struct command *commands)
{ … }
static const struct object_id *command_singleton_iterator(void *cb_data)
{ … }
static void set_connectivity_errors(struct command *commands,
struct shallow_info *si)
{ … }
struct iterate_data { … };
static const struct object_id *iterate_receive_command_list(void *cb_data)
{ … }
static void reject_updates_to_hidden(struct command *commands)
{ … }
static int should_process_cmd(struct command *cmd)
{ … }
static void BUG_if_skipped_connectivity_check(struct command *commands,
struct shallow_info *si)
{ … }
static void execute_commands_non_atomic(struct command *commands,
struct shallow_info *si)
{ … }
static void execute_commands_atomic(struct command *commands,
struct shallow_info *si)
{ … }
static void execute_commands(struct command *commands,
const char *unpacker_error,
struct shallow_info *si,
const struct string_list *push_options)
{ … }
static struct command **queue_command(struct command **tail,
const char *line,
int linelen)
{ … }
static void free_commands(struct command *commands)
{ … }
static void queue_commands_from_cert(struct command **tail,
struct strbuf *push_cert)
{ … }
static struct command *read_head_info(struct packet_reader *reader,
struct oid_array *shallow)
{ … }
static void read_push_options(struct packet_reader *reader,
struct string_list *options)
{ … }
static const char *parse_pack_header(struct pack_header *hdr)
{ … }
static struct tempfile *pack_lockfile;
static void push_header_arg(struct strvec *args, struct pack_header *hdr)
{ … }
static const char *unpack(int err_fd, struct shallow_info *si)
{ … }
static const char *unpack_with_sideband(struct shallow_info *si)
{ … }
static void prepare_shallow_update(struct shallow_info *si)
{ … }
static void update_shallow_info(struct command *commands,
struct shallow_info *si,
struct oid_array *ref)
{ … }
static void report(struct command *commands, const char *unpack_status)
{ … }
static void report_v2(struct command *commands, const char *unpack_status)
{ … }
static int delete_only(struct command *commands)
{ … }
int cmd_receive_pack(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{ … }