]> git.ipfire.org Git - thirdparty/git.git/blobdiff - send-pack.c
Merge branch 'js/default-branch-name'
[thirdparty/git.git] / send-pack.c
index 0abee22283dae8ceba42eb4b9b5ecb4842c98984..d671ab5d05c5dfd5acb1c597f68caf58d98dca9b 100644 (file)
@@ -363,6 +363,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;
@@ -389,6 +390,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);
@@ -406,7 +410,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)
@@ -429,6 +433,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());