diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-04-30 17:44:37 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-04-30 18:24:14 +0200 |
| commit | 39e6af6a7c526823b06f2c7bfe97c0c7bf9501d5 (patch) | |
| tree | b872cbcf20d72c0534c2d0cc2fff0d61a38a42dc /src/protocol.c | |
| parent | 8b9ec201edf157f84735b8d220c10edafd9f4b5a (diff) | |
| download | libgit2-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.c | 7 |
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; |
