diff options
author | Yuang Li <yuangli88@hotmail.com> | 2022-09-05 16:24:38 +0100 |
---|---|---|
committer | Yuang Li <yuangli88@hotmail.com> | 2022-09-05 16:24:38 +0100 |
commit | 7122fcd2e4da67905df0d293d0223371b4ffdf01 (patch) | |
tree | 5e62752e6414cd77bc632a65886e93b4431d88dd | |
parent | 34de5c87fb118ffa177bf2e6a023aee72c4f46f7 (diff) | |
download | libgit2-7122fcd2e4da67905df0d293d0223371b4ffdf01.tar.gz |
fix depth initialisation
-rw-r--r-- | src/libgit2/fetch.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libgit2/fetch.c b/src/libgit2/fetch.c index 69794ed1f..df8f0a154 100644 --- a/src/libgit2/fetch.c +++ b/src/libgit2/fetch.c @@ -62,8 +62,8 @@ static int mark_local(git_remote *remote) git_vector_foreach(&remote->refs, i, head) { /* 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 - even though the head exists locally. */ + However if we are unshallowing, we need to ask for it + even though the head exists locally. */ if (remote->nego.depth != INT_MAX && git_odb_exists(odb, &head->oid)) head->local = 1; else @@ -177,7 +177,10 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts) 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) return -1; |