summaryrefslogtreecommitdiff
path: root/src/protocol.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-04-30 17:44:37 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-04-30 18:24:14 +0200
commit39e6af6a7c526823b06f2c7bfe97c0c7bf9501d5 (patch)
treeb872cbcf20d72c0534c2d0cc2fff0d61a38a42dc /src/protocol.c
parent8b9ec201edf157f84735b8d220c10edafd9f4b5a (diff)
downloadlibgit2-39e6af6a7c526823b06f2c7bfe97c0c7bf9501d5.tar.gz
net: recognize and report server-side error messages
When e.g. a repository isn't found, the server sends an error saying so. Put that error message in our error buffer.
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 4c4a7f79b..d1bfc5152 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -40,6 +40,13 @@ int git_protocol_store_refs(git_protocol *p, const char *data, size_t len)
return p->error = -1;
git_buf_consume(buf, line_end);
+
+ if (pkt->type == GIT_PKT_ERR) {
+ giterr_set(GITERR_NET, "Remote error: %s", ((git_pkt_err *)pkt)->error);
+ git__free(pkt);
+ return -1;
+ }
+
if (git_vector_insert(refs, pkt) < 0)
return p->error = -1;