diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-07-17 00:42:48 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-07-17 00:42:48 (GMT) |
commit | b2fc8226294e52c7f08533b202f2b90ce72b7eaf (patch) | |
tree | 49f3d074e3ef48dcdc288a4524d0fda003ec0dc5 /send-pack.c | |
parent | 368cab75c1e14c728b3767bad5ec6d46d6f29238 (diff) | |
parent | eff40457a4ab4887c677453d11774322a494a98c (diff) | |
download | git-b2fc8226294e52c7f08533b202f2b90ce72b7eaf.zip git-b2fc8226294e52c7f08533b202f2b90ce72b7eaf.tar.gz git-b2fc8226294e52c7f08533b202f2b90ce72b7eaf.tar.bz2 |
Merge branch 'ab/fetch-negotiate-segv-fix'
Code recently added to support common ancestry negotiation during
"git push" did not sanity check its arguments carefully enough.
* ab/fetch-negotiate-segv-fix:
fetch: fix segfault in --negotiate-only without --negotiation-tip=*
fetch: document the --negotiate-only option
send-pack.c: move "no refs in common" abort earlier
Diffstat (limited to 'send-pack.c')
-rw-r--r-- | send-pack.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/send-pack.c b/send-pack.c index 9cb9f71..5a79e0e 100644 --- a/send-pack.c +++ b/send-pack.c @@ -486,6 +486,12 @@ int send_pack(struct send_pack_args *args, const char *push_cert_nonce = NULL; struct packet_reader reader; + if (!remote_refs) { + fprintf(stderr, "No refs in common and none specified; doing nothing.\n" + "Perhaps you should specify a branch.\n"); + return 0; + } + git_config_get_bool("push.negotiate", &push_negotiate); if (push_negotiate) get_commons_through_negotiation(args->url, remote_refs, &commons); @@ -534,11 +540,6 @@ 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.\n"); - return 0; - } if (args->atomic && !atomic_supported) die(_("the receiving end does not support --atomic push")); |