summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-14 22:23:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-14 22:23:18 (GMT)
commit07198afbd19f5ba4f991d9b554bc320690de19dc (patch)
treeaf4a70e09a97335a1b5db7ce0f61f179c47f905b /transport.c
parentc809496c97122b7d297e7216c3bfff7262b212e0 (diff)
parentd56583ded679f2eade3994d855c8d605e2964710 (diff)
downloadgit-07198afbd19f5ba4f991d9b554bc320690de19dc.zip
git-07198afbd19f5ba4f991d9b554bc320690de19dc.tar.gz
git-07198afbd19f5ba4f991d9b554bc320690de19dc.tar.bz2
Merge branch 'mm/fetch-show-error-message-on-unadvertised-object'
"git fetch" that requests a commit by object name, when the other side does not allow such an request, failed without much explanation. * mm/fetch-show-error-message-on-unadvertised-object: fetch-pack: add specific error for fetching an unadvertised object fetch_refs_via_pack: call report_unmatched_refs fetch-pack: move code to report unmatched refs to a function
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/transport.c b/transport.c
index 5828e06..ea1feac 100644
--- a/transport.c
+++ b/transport.c
@@ -204,6 +204,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
static int fetch_refs_via_pack(struct transport *transport,
int nr_heads, struct ref **to_fetch)
{
+ int ret = 0;
struct git_transport_data *data = transport->data;
struct ref *refs;
char *dest = xstrdup(transport->url);
@@ -241,19 +242,22 @@ static int fetch_refs_via_pack(struct transport *transport,
&transport->pack_lockfile);
close(data->fd[0]);
close(data->fd[1]);
- if (finish_connect(data->conn)) {
- free_refs(refs);
- refs = NULL;
- }
+ if (finish_connect(data->conn))
+ ret = -1;
data->conn = NULL;
data->got_remote_heads = 0;
data->options.self_contained_and_connected =
args.self_contained_and_connected;
+ if (refs == NULL)
+ ret = -1;
+ if (report_unmatched_refs(to_fetch, nr_heads))
+ ret = -1;
+
free_refs(refs_tmp);
free_refs(refs);
free(dest);
- return (refs ? 0 : -1);
+ return ret;
}
static int push_had_errors(struct ref *ref)