Commit 7122fcd2 by Yuang Li

fix depth initialisation

parent 34de5c87
...@@ -62,8 +62,8 @@ static int mark_local(git_remote *remote) ...@@ -62,8 +62,8 @@ static int mark_local(git_remote *remote)
git_vector_foreach(&remote->refs, i, head) { git_vector_foreach(&remote->refs, i, head) {
/* 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.
However if we are unshallowing, we need to ask for it However if we are unshallowing, we need to ask for it
even though the head exists locally. */ even though the head exists locally. */
if (remote->nego.depth != INT_MAX && git_odb_exists(odb, &head->oid)) if (remote->nego.depth != INT_MAX && git_odb_exists(odb, &head->oid))
head->local = 1; head->local = 1;
else else
...@@ -177,7 +177,10 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts) ...@@ -177,7 +177,10 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
remote->need_pack = 0; remote->need_pack = 0;
remote->nego.depth = (opts && !opts->unshallow) ? opts->depth : INT_MAX; if (!opts)
remote->nego.depth = -1;
else
remote->nego.depth = opts->unshallow ? INT_MAX : opts->depth;
if (filter_wants(remote, opts) < 0) if (filter_wants(remote, opts) < 0)
return -1; return -1;
......
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