Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/send-pack.c b/send-pack.c
index dfaf505c96..2d2f9997ac 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -15,6 +15,7 @@
#include "oid-array.h"
#include "gpg-interface.h"
#include "cache.h"
+#include "shallow.h"
int option_parse_push_signed(const struct option *opt,
const char *arg, int unset)
@@ -67,20 +68,20 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struc
int i;
int rc;
- argv_array_push(&po.args, "pack-objects");
- argv_array_push(&po.args, "--all-progress-implied");
- argv_array_push(&po.args, "--revs");
- argv_array_push(&po.args, "--stdout");
+ strvec_push(&po.args, "pack-objects");
+ strvec_push(&po.args, "--all-progress-implied");
+ strvec_push(&po.args, "--revs");
+ strvec_push(&po.args, "--stdout");
if (args->use_thin_pack)
- argv_array_push(&po.args, "--thin");
+ strvec_push(&po.args, "--thin");
if (args->use_ofs_delta)
- argv_array_push(&po.args, "--delta-base-offset");
+ strvec_push(&po.args, "--delta-base-offset");
if (args->quiet || !args->progress)
- argv_array_push(&po.args, "-q");
+ strvec_push(&po.args, "-q");
if (args->progress)
- argv_array_push(&po.args, "--progress");
+ strvec_push(&po.args, "--progress");
if (is_repository_shallow(the_repository))
- argv_array_push(&po.args, "--shallow");
+ strvec_push(&po.args, "--shallow");
po.in = -1;
po.out = args->stateless_rpc ? -1 : fd;
po.git_cmd = 1;
@@ -421,6 +422,7 @@ int send_pack(struct send_pack_args *args,
int atomic_supported = 0;
int use_push_options = 0;
int push_options_supported = 0;
+ int object_format_supported = 0;
unsigned cmds_sent = 0;
int ret;
struct async demux;
@@ -449,6 +451,9 @@ int send_pack(struct send_pack_args *args,
if (server_supports("push-options"))
push_options_supported = 1;
+ if (!server_supports_hash(the_hash_algo->name, &object_format_supported))
+ die(_("the receiving end does not support this repository's hash algorithm"));
+
if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) {
int len;
push_cert_nonce = server_feature_value("push-cert", &len);
@@ -466,7 +471,7 @@ int send_pack(struct send_pack_args *args,
if (!remote_refs) {
fprintf(stderr, "No refs in common and none specified; doing nothing.\n"
- "Perhaps you should specify a branch such as 'master'.\n");
+ "Perhaps you should specify a branch.\n");
return 0;
}
if (args->atomic && !atomic_supported)
@@ -491,6 +496,8 @@ int send_pack(struct send_pack_args *args,
strbuf_addstr(&cap_buf, " atomic");
if (use_push_options)
strbuf_addstr(&cap_buf, " push-options");
+ if (object_format_supported)
+ strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name);
if (agent_supported)
strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized());