Commit f1f9b45d by Yuang Li

fix test failures

parent b20f013c
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "repository.h" #include "repository.h"
#include "refs.h" #include "refs.h"
#include "transports/smart.h" #include "transports/smart.h"
#include <limits.h>
static int maybe_want(git_remote *remote, git_remote_head *head, git_refspec *tagspec, git_remote_autotag_option_t tagopt) static int maybe_want(git_remote *remote, git_remote_head *head, git_refspec *tagspec, git_remote_autotag_option_t tagopt)
{ {
...@@ -175,7 +176,8 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts) ...@@ -175,7 +176,8 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
git_transport *t = remote->transport; git_transport *t = remote->transport;
remote->need_pack = 0; remote->need_pack = 0;
remote->nego.depth = opts->unshallow ? INT_MAX : opts->depth;
remote->nego.depth = (opts && !opts->unshallow) ? opts->depth : INT_MAX;
if (filter_wants(remote, opts) < 0) if (filter_wants(remote, opts) < 0)
return -1; return -1;
...@@ -184,7 +186,7 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts) ...@@ -184,7 +186,7 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
if (!remote->need_pack) if (!remote->need_pack)
return 0; return 0;
if (opts->unshallow && opts->depth > 0) { if (opts && opts->unshallow && opts->depth > 0) {
git_error_set(GIT_ERROR_INVALID, "options '--depth' and '--unshallow' cannot be used together"); git_error_set(GIT_ERROR_INVALID, "options '--depth' and '--unshallow' cannot be used together");
return -1; return -1;
} }
......
...@@ -133,7 +133,7 @@ int git_grafts_parse(git_grafts *grafts, const char *content, size_t contentlen) ...@@ -133,7 +133,7 @@ int git_grafts_parse(git_grafts *grafts, const char *content, size_t contentlen)
const char *line_start = parser.line, *line_end = parser.line + parser.line_len; const char *line_start = parser.line, *line_end = parser.line + parser.line_len;
git_oid graft_oid; git_oid graft_oid;
if ((error = git_oid_fromstrn(&graft_oid, line_start, GIT_OID_SHA1_HEXSIZE)) < 0) { if ((error = git_oid__fromstrn(&graft_oid, line_start, GIT_OID_SHA1_HEXSIZE, GIT_OID_SHA1)) < 0) {
git_error_set(GIT_ERROR_GRAFTS, "invalid graft OID at line %" PRIuZ, parser.line_num); git_error_set(GIT_ERROR_GRAFTS, "invalid graft OID at line %" PRIuZ, parser.line_num);
goto error; goto error;
} }
...@@ -143,7 +143,7 @@ int git_grafts_parse(git_grafts *grafts, const char *content, size_t contentlen) ...@@ -143,7 +143,7 @@ int git_grafts_parse(git_grafts *grafts, const char *content, size_t contentlen)
git_oid *id = git_array_alloc(parents); git_oid *id = git_array_alloc(parents);
GIT_ERROR_CHECK_ALLOC(id); GIT_ERROR_CHECK_ALLOC(id);
if ((error = git_oid_fromstrn(id, ++line_start, GIT_OID_SHA1_HEXSIZE)) < 0) { if ((error = git_oid__fromstrn(id, ++line_start, GIT_OID_SHA1_HEXSIZE, GIT_OID_SHA1)) < 0) {
git_error_set(GIT_ERROR_GRAFTS, "invalid parent OID at line %" PRIuZ, parser.line_num); git_error_set(GIT_ERROR_GRAFTS, "invalid parent OID at line %" PRIuZ, parser.line_num);
goto error; goto error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment