mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 18:38:58 +00:00
Merge pull request #2141 from ravselj/development
BUGFIX - Fetching twice from the same remote causes a segfault
This commit is contained in:
commit
0511b15c82
@ -57,6 +57,10 @@ IF(MSVC)
|
|||||||
# By default, libgit2 is built with WinHTTP. To use the built-in
|
# By default, libgit2 is built with WinHTTP. To use the built-in
|
||||||
# HTTP transport, invoke CMake with the "-DWINHTTP=OFF" argument.
|
# HTTP transport, invoke CMake with the "-DWINHTTP=OFF" argument.
|
||||||
OPTION( WINHTTP "Use Win32 WinHTTP routines" ON )
|
OPTION( WINHTTP "Use Win32 WinHTTP routines" ON )
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
||||||
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# This variable will contain the libraries we need to put into
|
# This variable will contain the libraries we need to put into
|
||||||
|
@ -78,7 +78,7 @@ int print_matched_cb(const char *path, const char *matched_pathspec, void *paylo
|
|||||||
git_status_t status;
|
git_status_t status;
|
||||||
(void)matched_pathspec;
|
(void)matched_pathspec;
|
||||||
|
|
||||||
if (git_status_file(&status, p.repo, path)) {
|
if (git_status_file((unsigned int*)(&status), p.repo, path)) {
|
||||||
return -1; //abort
|
return -1; //abort
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +107,9 @@ int main(int argc, char *argv[])
|
|||||||
if (break_on_null_hunk && !hunk) break;
|
if (break_on_null_hunk && !hunk) break;
|
||||||
|
|
||||||
if (hunk) {
|
if (hunk) {
|
||||||
break_on_null_hunk = 1;
|
|
||||||
char sig[128] = {0};
|
char sig[128] = {0};
|
||||||
|
break_on_null_hunk = 1;
|
||||||
|
|
||||||
|
|
||||||
git_oid_tostr(oid, 10, &hunk->final_commit_id);
|
git_oid_tostr(oid, 10, &hunk->final_commit_id);
|
||||||
snprintf(sig, 30, "%s <%s>", hunk->final_signature->name, hunk->final_signature->email);
|
snprintf(sig, 30, "%s <%s>", hunk->final_signature->name, hunk->final_signature->email);
|
||||||
|
@ -42,7 +42,7 @@ static void print_signature(const char *header, const git_signature *sig)
|
|||||||
static void show_blob(const git_blob *blob)
|
static void show_blob(const git_blob *blob)
|
||||||
{
|
{
|
||||||
/* ? Does this need crlf filtering? */
|
/* ? Does this need crlf filtering? */
|
||||||
fwrite(git_blob_rawcontent(blob), git_blob_rawsize(blob), 1, stdout);
|
fwrite(git_blob_rawcontent(blob), (size_t)git_blob_rawsize(blob), 1, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Show each entry with its type, id and attributes */
|
/** Show each entry with its type, id and attributes */
|
||||||
|
@ -156,7 +156,7 @@ int diff_output(
|
|||||||
const git_diff_line *l,
|
const git_diff_line *l,
|
||||||
void *p)
|
void *p)
|
||||||
{
|
{
|
||||||
FILE *fp = p;
|
FILE *fp = (FILE*)p;
|
||||||
|
|
||||||
(void)d; (void)h;
|
(void)d; (void)h;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ static void print_progress(const progress_data *pd)
|
|||||||
int index_percent = (100*pd->fetch_progress.indexed_objects) / pd->fetch_progress.total_objects;
|
int index_percent = (100*pd->fetch_progress.indexed_objects) / pd->fetch_progress.total_objects;
|
||||||
int checkout_percent = pd->total_steps > 0
|
int checkout_percent = pd->total_steps > 0
|
||||||
? (100 * pd->completed_steps) / pd->total_steps
|
? (100 * pd->completed_steps) / pd->total_steps
|
||||||
: 0.f;
|
: 0;
|
||||||
int kbytes = pd->fetch_progress.received_bytes / 1024;
|
int kbytes = pd->fetch_progress.received_bytes / 1024;
|
||||||
|
|
||||||
if (pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) {
|
if (pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) {
|
||||||
|
@ -42,8 +42,10 @@ static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, g
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* If we have the object, mark it so we don't ask for it */
|
/* 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;
|
head->local = 1;
|
||||||
|
remote->need_pack = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
remote->need_pack = 1;
|
remote->need_pack = 1;
|
||||||
|
|
||||||
|
@ -579,6 +579,10 @@ int git_smart__download_pack(
|
|||||||
done:
|
done:
|
||||||
if (writepack)
|
if (writepack)
|
||||||
writepack->free(writepack);
|
writepack->free(writepack);
|
||||||
|
if (progress_cb) {
|
||||||
|
t->packetsize_cb = NULL;
|
||||||
|
t->packetsize_payload = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
static int gen_proto(git_buf *request, const char *cmd, const char *url)
|
||||||
{
|
{
|
||||||
char *repo;
|
char *repo;
|
||||||
|
int len;
|
||||||
|
|
||||||
if (!git__prefixcmp(url, prefix_ssh)) {
|
if (!git__prefixcmp(url, prefix_ssh)) {
|
||||||
url = url + strlen(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;
|
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_grow(request, len);
|
||||||
git_buf_printf(request, "%s '%s'", cmd, repo);
|
git_buf_printf(request, "%s '%s'", cmd, repo);
|
||||||
|
Loading…
Reference in New Issue
Block a user