diff options
author | Vicent Marti <vicent@github.com> | 2014-03-03 15:05:26 +0100 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-03-03 15:05:26 +0100 |
commit | 0511b15c82a6af253d9bd18ddeed85f8afd28ddd (patch) | |
tree | c028e6881d07e43d21218d0150e71d81f9b4030a /src | |
parent | bb3687c5a8180c39d12b437ca1822ac43482b26f (diff) | |
parent | b43f35fde2fa977870280d685b6e96418b82752e (diff) | |
download | libgit2-0511b15c82a6af253d9bd18ddeed85f8afd28ddd.tar.gz |
Merge pull request #2141 from ravselj/development
BUGFIX - Fetching twice from the same remote causes a segfault
Diffstat (limited to 'src')
-rw-r--r-- | src/fetch.c | 4 | ||||
-rw-r--r-- | src/transports/smart_protocol.c | 4 | ||||
-rw-r--r-- | src/transports/ssh.c | 3 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/fetch.c b/src/fetch.c index 5bf2b93c1..c7d2c83a1 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -42,8 +42,10 @@ static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, g return 0; /* If we have the object, mark it so we don't ask for it */ - if (git_odb_exists(odb, &head->oid)) + if (git_odb_exists(odb, &head->oid)) { head->local = 1; + remote->need_pack = 0; + } else remote->need_pack = 1; diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c index dd9b5e0ed..7e8fcdd92 100644 --- a/src/transports/smart_protocol.c +++ b/src/transports/smart_protocol.c @@ -579,6 +579,10 @@ int git_smart__download_pack( done: if (writepack) writepack->free(writepack); + if (progress_cb) { + t->packetsize_cb = NULL; + t->packetsize_payload = NULL; + } return error; } diff --git a/src/transports/ssh.c b/src/transports/ssh.c index 37f17080a..bece0b45d 100644 --- a/src/transports/ssh.c +++ b/src/transports/ssh.c @@ -53,6 +53,7 @@ static void ssh_error(LIBSSH2_SESSION *session, const char *errmsg) static int gen_proto(git_buf *request, const char *cmd, const char *url) { char *repo; + int len; if (!git__prefixcmp(url, prefix_ssh)) { url = url + strlen(prefix_ssh); @@ -67,7 +68,7 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url) return -1; } - int len = strlen(cmd) + 1 /* Space */ + 1 /* Quote */ + strlen(repo) + 1 /* Quote */ + 1; + len = strlen(cmd) + 1 /* Space */ + 1 /* Quote */ + strlen(repo) + 1 /* Quote */ + 1; git_buf_grow(request, len); git_buf_printf(request, "%s '%s'", cmd, repo); |