static int mark_tags;
static struct string_list extra_refs = STRING_LIST_INIT_DUP;
static struct string_list tag_refs = STRING_LIST_INIT_DUP;
-static struct refspec refspecs = REFSPEC_INIT_FETCH;
+static struct refspec refspecs;
static int anonymize;
static struct hashmap anonymized_seeds;
static struct revision_sources revision_sources;
/* we handle encodings */
repo_config(the_repository, git_default_config, NULL);
+ refspec_init_fetch(&refspecs, the_hash_algo);
+
repo_init_revisions(the_repository, &revs, prefix);
init_revision_sources(&revision_sources);
revs.topo_order = 1;
static struct strbuf default_rla = STRBUF_INIT;
static struct transport *gtransport;
static struct transport *gsecondary;
-static struct refspec refmap = REFSPEC_INIT_FETCH;
+static struct refspec refmap;
static struct string_list server_options = STRING_LIST_INIT_DUP;
static struct string_list negotiation_restrict = STRING_LIST_INIT_NODUP;
static struct string_list negotiation_include = STRING_LIST_INIT_NODUP;
const struct fetch_config *config,
struct list_objects_filter_options *filter_options)
{
- struct refspec rs = REFSPEC_INIT_FETCH;
+ struct refspec rs = REFSPEC_INIT_FETCH(the_hash_algo);
int i;
int exit_code;
int maybe_prune_tags;
filter_options.allow_auto_filter = 1;
+ refspec_init_fetch(&refmap, the_hash_algo);
+
packet_trace_identity("fetch");
/* Record the command line for the reflog */
static struct push_cas_option cas;
-static struct refspec rs = REFSPEC_INIT_PUSH;
+static struct refspec rs;
static struct string_list push_options_config = STRING_LIST_INIT_DUP;
: &push_options_config);
set_push_cert_flags(&flags, push_cert);
+ refspec_init_push(&rs, the_hash_algo);
+
die_for_incompatible_opt4(deleterefs, "--delete",
tags, "--tags",
flags & TRANSPORT_PUSH_ALL, "--all/--branches",
}
refspec_clear(&rs);
- rs = (struct refspec) REFSPEC_INIT_PUSH;
+ rs = (struct refspec) REFSPEC_INIT_PUSH(the_hash_algo);
if (tags)
refspec_append(&rs, "refs/tags/*");
const char *prefix,
struct repository *repo)
{
- struct refspec rs = REFSPEC_INIT_PUSH;
+ struct refspec rs;
const char *remote_name = NULL;
struct remote *remote = NULL;
const char *dest = NULL;
repo_config(repo, send_pack_config, NULL);
argc = parse_options(argc, argv, prefix, options, send_pack_usage, 0);
+
+ refspec_init_push(&rs, repo->hash_algo);
+
if (argc > 0) {
dest = argv[0];
refspec_appendn(&rs, argv + 1, argc - 1);
if (argc > 2) {
int i;
struct ref *local_refs = get_local_heads();
- struct refspec refspec = REFSPEC_INIT_PUSH;
+ struct refspec refspec = REFSPEC_INIT_PUSH(the_hash_algo);
refspec_appendn(&refspec, argv + 2, argc - 2);
{
struct transfer_request *request;
struct transfer_request *next_request;
- struct refspec rs = REFSPEC_INIT_PUSH;
+ struct refspec rs = REFSPEC_INIT_PUSH(the_hash_algo);
struct remote_lock *ref_lock = NULL;
struct remote_lock *info_ref_lock = NULL;
int delete_branch = 0;
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
item->exact_sha1 = 0;
}
-void refspec_init_fetch(struct refspec *rs)
+void refspec_init_fetch(struct refspec *rs, const struct git_hash_algo *algo)
{
- struct refspec blank = REFSPEC_INIT_FETCH;
+ struct refspec blank = REFSPEC_INIT_FETCH(algo);
memcpy(rs, &blank, sizeof(*rs));
}
-void refspec_init_push(struct refspec *rs)
+void refspec_init_push(struct refspec *rs, const struct git_hash_algo *algo)
{
- struct refspec blank = REFSPEC_INIT_PUSH;
+ struct refspec blank = REFSPEC_INIT_PUSH(algo);
memcpy(rs, &blank, sizeof(*rs));
}
int ret;
if (rs->fetch)
- ret = refspec_item_init_fetch(&item, refspec, the_hash_algo);
+ ret = refspec_item_init_fetch(&item, refspec, rs->hash_algo);
else
- ret = refspec_item_init_push(&item, refspec, the_hash_algo);
+ ret = refspec_item_init_push(&item, refspec, rs->hash_algo);
if (!ret)
die(_("invalid refspec '%s'"), refspec);
int alloc;
int nr;
+ const struct git_hash_algo *hash_algo;
unsigned fetch : 1;
};
-#define REFSPEC_INIT_FETCH { .fetch = 1 }
-#define REFSPEC_INIT_PUSH { .fetch = 0 }
-
-void refspec_init_fetch(struct refspec *rs);
-void refspec_init_push(struct refspec *rs);
+#define REFSPEC_INIT_FETCH(algo) { \
+ .fetch = 1, \
+ .hash_algo = (algo), \
+}
+#define REFSPEC_INIT_PUSH(algo) { \
+ .fetch = 0, \
+ .hash_algo = (algo), \
+}
+
+void refspec_init_fetch(struct refspec *rs, const struct git_hash_algo *hash_algo);
+void refspec_init_push(struct refspec *rs, const struct git_hash_algo *hash_algo);
void refspec_clear(struct refspec *rs);
void refspec_append(struct refspec *rs, const char *refspec);
ret->prune = -1; /* unspecified */
ret->prune_tags = -1; /* unspecified */
ret->name = xstrndup(name, len);
- refspec_init_push(&ret->push);
- refspec_init_fetch(&ret->fetch);
+ refspec_init_push(&ret->push, the_hash_algo);
+ refspec_init_fetch(&ret->fetch, the_hash_algo);
string_list_init_dup(&ret->server_options);
string_list_init_dup(&ret->negotiation_restrict);
string_list_init_dup(&ret->negotiation_include);
data->helper = helper;
data->no_disconnect_req = 0;
- refspec_init_fetch(&data->rs);
+ refspec_init_fetch(&data->rs, the_hash_algo);
/*
* Open the output as FILE* so strbuf_getline_*() family of