Branch Coverage

deps/libgit2/src/remote.c
Criterion Covered Total %
branch 241 968 24.9


line true false branch
38 0 13 GIT_ERROR_CHECK_ALLOC(spec);
40 0 13 if (git_refspec__parse(spec, string, is_fetch) < 0) {
46 0 13 if (git_vector_insert(vector, spec) < 0) {
66 0 10 if (git_buf_printf(&buf, "remote.%s.tagopt", remote->name) < 0)
72 10 0 if (!error && ce && ce->value) {
0 10 if (!error && ce && ce->value) {
0 0 if (!error && ce && ce->value) {
73 0 0 if (!strcmp(ce->value, "--no-tags"))
75 0 0 else if (!strcmp(ce->value, "--tags"))
87 0 26 if (!git_remote_is_valid_name(name)) {
88 0 0 git_error_set(
105 0 3 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
108 3 0 fmt = fetch ? CONFIG_FETCH_FMT : CONFIG_PUSH_FMT;
110 0 3 if ((error = ensure_remote_name_is_valid(name)) < 0)
113 0 3 if ((error = git_refspec__parse(&spec, refspec, fetch)) < 0) {
114 0 0 if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
122 0 3 if ((error = git_buf_printf(&var, fmt, name)) < 0)
130 0 3 if ((error = git_config_set_multivar(cfg, var.ptr, "$^", refspec)) < 0) {
141 9 0 if (in == NULL || strlen(in) == 0) {
0 9 if (in == NULL || strlen(in) == 0) {
165 0 4 if (git_buf_printf(buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0)
178 4 0 if (error == GIT_ENOTFOUND)
181 0 0 if (error < 0)
193 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
215 5 0 assert(out && url);
0 5 assert(out && url);
217 0 5 if (!opts) {
221 0 5 GIT_ERROR_CHECK_VERSION(opts, GIT_REMOTE_CREATE_OPTIONS_VERSION, "git_remote_create_options");
223 3 2 if (opts->name != NULL) {
224 0 3 if ((error = ensure_remote_name_is_valid(opts->name)) < 0)
227 3 0 if (opts->repository &&
0 3 if (opts->repository &&
232 5 0 if (opts->repository) {
233 0 5 if ((error = git_repository_config_snapshot(&config_ro, opts->repository)) < 0)
238 0 5 GIT_ERROR_CHECK_ALLOC(remote);
242 5 0 if ((error = git_vector_init(&remote->refs, 8, NULL)) < 0 ||
5 0 if ((error = git_vector_init(&remote->refs, 8, NULL)) < 0 ||
246 5 0 if (opts->repository && !(opts->flags & GIT_REMOTE_CREATE_SKIP_INSTEADOF)) {
5 0 if (opts->repository && !(opts->flags & GIT_REMOTE_CREATE_SKIP_INSTEADOF)) {
251 0 5 GIT_ERROR_CHECK_ALLOC(remote->url);
253 3 2 if (opts->name != NULL) {
255 0 3 GIT_ERROR_CHECK_ALLOC(remote->name);
257 3 0 if (opts->repository &&
3 0 if (opts->repository &&
258 3 0 ((error = git_buf_printf(&var, CONFIG_URL_FMT, opts->name)) < 0 ||
259 3 0 (error = git_repository_config__weakptr(&config_rw, opts->repository)) < 0 ||
264 4 1 if (opts->fetchspec != NULL ||
2 2 if (opts->fetchspec != NULL ||
265 2 0 (opts->name && !(opts->flags & GIT_REMOTE_CREATE_SKIP_DEFAULT_FETCHSPEC))) {
267 1 2 if (opts->fetchspec) {
270 0 2 if ((error = default_fetchspec_for_name(&specbuf, opts->name)) < 0)
276 0 3 if ((error = add_refspec(remote, fetch, true)) < 0)
280 3 0 if (opts->repository && opts->name &&
3 0 if (opts->repository && opts->name &&
3 0 if (opts->repository && opts->name &&
281 3 0 ((error = write_add_refspec(opts->repository, opts->name, fetch, true)) < 0 ||
286 0 3 if ((error = dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs)) < 0)
291 2 3 if (!opts->name)
303 0 5 if (error)
320 0 2 if ((error = ensure_remote_name_is_valid(name)) < 0)
323 0 2 if (canonicalize_url(&buf, url) < 0)
343 0 1 if ((error = ensure_remote_name_is_valid(name)) < 0)
374 0 0 GIT_ERROR_CHECK_ALLOC(remote);
376 0 0 if (source->name != NULL) {
378 0 0 GIT_ERROR_CHECK_ALLOC(remote->name);
381 0 0 if (source->url != NULL) {
383 0 0 GIT_ERROR_CHECK_ALLOC(remote->url);
386 0 0 if (source->pushurl != NULL) {
388 0 0 GIT_ERROR_CHECK_ALLOC(remote->pushurl);
396 0 0 git_vector_init(&remote->refspecs, 2, NULL) < 0 ||
402 0 0 git_vector_foreach(&source->refspecs, i, spec) {
403 0 0 if ((error = add_refspec(remote, spec->string, !spec->push)) < 0)
411 0 0 if (error < 0)
435 0 48 if (git_buf_oom(buf))
438 20 28 if (cb != NULL)
443 28 20 if (found)
446 25 23 if (error == GIT_ENOTFOUND) {
464 14 0 assert(out && repo && name);
14 0 assert(out && repo && name);
0 14 assert(out && repo && name);
466 0 14 if ((error = ensure_remote_name_is_valid(name)) < 0)
469 0 14 if ((error = git_repository_config_snapshot(&config, repo)) < 0)
473 0 14 GIT_ERROR_CHECK_ALLOC(remote);
476 0 14 GIT_ERROR_CHECK_ALLOC(remote->name);
479 14 0 git_vector_init(&remote->refspecs, 2, NULL) < 0 ||
480 0 14 git_vector_init(&remote->passive_refspecs, 2, NULL) < 0 ||
486 0 14 if ((error = git_buf_printf(&buf, "remote.%s.url", name)) < 0)
489 0 14 if ((error = get_optional_config(&found, config, &buf, NULL, (void *)&val)) < 0)
497 10 4 if (found && strlen(val) > 0) {
10 0 if (found && strlen(val) > 0) {
499 0 10 GIT_ERROR_CHECK_ALLOC(remote->url);
506 0 14 if ((error = get_optional_config(&found, config, &buf, NULL, (void *)&val)) < 0)
511 4 10 if (!optional_setting_found) {
517 3 7 if (found && strlen(val) > 0) {
3 0 if (found && strlen(val) > 0) {
519 0 3 GIT_ERROR_CHECK_ALLOC(remote->pushurl);
528 0 10 if ((error = get_optional_config(NULL, config, &buf, refspec_cb, &data)) < 0)
535 0 10 if ((error = get_optional_config(NULL, config, &buf, refspec_cb, &data)) < 0)
538 0 10 if ((error = download_tags_value(remote, config)) < 0)
541 0 10 if ((error = lookup_remote_prune_config(remote, config, name)) < 0)
545 0 10 if ((error = dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs)) < 0)
554 4 10 if (error < 0)
567 13 0 if ((error = git_config_get_bool(&remote->prune_refs, config, git_buf_cstr(&buf))) < 0) {
568 13 0 if (error == GIT_ENOTFOUND) {
571 13 0 if ((error = git_config_get_bool(&remote->prune_refs, config, "fetch.prune")) < 0) {
572 13 0 if (error == GIT_ENOTFOUND) {
586 0 6 assert(remote);
592 0 2 assert(remote);
598 0 2 assert(remote);
608 2 0 assert(repo && remote);
0 2 assert(repo && remote);
610 0 2 if ((error = ensure_remote_name_is_valid(remote)) < 0)
613 0 2 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
616 0 2 if ((error = git_buf_printf(&buf, pattern, remote)) < 0)
619 2 0 if (url) {
620 0 2 if ((error = canonicalize_url(&canonical_url, url)) < 0)
642 0 1 assert(remote);
655 2 0 if (callbacks && callbacks->resolve_url) {
0 2 if (callbacks && callbacks->resolve_url) {
658 0 0 if (status != GIT_PASSTHROUGH) {
672 0 2 assert(remote);
673 2 0 assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
0 2 assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
675 0 2 if (direction == GIT_DIRECTION_FETCH) {
677 2 0 } else if (direction == GIT_DIRECTION_PUSH) {
678 0 2 url = remote->pushurl ? remote->pushurl : remote->url;
681 0 2 if (!url) {
682 0 0 git_error_set(GIT_ERROR_INVALID,
0 0 git_error_set(GIT_ERROR_INVALID,
693 2 0 if (!t->set_callbacks || !cbs)
0 2 if (!t->set_callbacks || !cbs)
702 2 0 if (!t->set_custom_headers)
718 0 2 assert(remote);
720 2 0 if (callbacks) {
721 0 2 GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
727 2 0 if (conn->proxy)
728 0 2 GIT_ERROR_CHECK_VERSION(conn->proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
732 0 2 if ((error = git_remote__urlfordirection(&url, remote, direction, callbacks)) < 0)
737 2 0 if (!t && transport &&
0 2 if (!t && transport &&
0 0 if (!t && transport &&
743 2 0 if (!t && (error = git_transport_new(&t, remote, url.ptr)) < 0)
0 2 if (!t && (error = git_transport_new(&t, remote, url.ptr)) < 0)
746 0 2 if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
749 2 0 if ((error = remote_transport_set_callbacks(t, callbacks)) < 0 ||
2 0 if ((error = remote_transport_set_callbacks(t, callbacks)) < 0 ||
760 0 0 if (t)
765 0 0 if (t == remote->transport)
783 0 2 assert(remote);
785 0 2 if (!remote->transport) {
800 0 0 assert(remote);
802 0 0 if (!proxy_url || !remote->repo)
0 0 if (!proxy_url || !remote->repo)
807 0 0 if ((error = git_repository_config__weakptr(&cfg, remote->repo)) < 0)
814 0 0 if (remote->name && remote->name[0]) {
0 0 if (remote->name && remote->name[0]) {
817 0 0 if ((error = git_buf_printf(&buf, "remote.%s.proxy", remote->name)) < 0)
823 0 0 if (error < 0)
826 0 0 if (ce && ce->value) {
0 0 if (ce && ce->value) {
833 0 0 if ((error = git_config__lookup_entry(&ce, cfg, "http.proxy", false)) < 0)
836 0 0 if (ce && ce->value) {
0 0 if (ce && ce->value) {
842 0 0 error = git__getenv(&val, use_ssl ? "https_proxy" : "http_proxy");
845 0 0 if (error == GIT_ENOTFOUND)
846 0 0 error = git__getenv(&val, use_ssl ? "HTTPS_PROXY" : "HTTP_PROXY");
848 0 0 if (error < 0) {
849 0 0 if (error == GIT_ENOTFOUND) {
860 0 0 GIT_ERROR_CHECK_ALLOC(*proxy_url);
872 13 15 git_vector_foreach(refspecs, i, spec) {
873 0 13 if (git_refspec__dwim_one(out, spec, refs) < 0)
885 10 29 git_vector_foreach(vec, i, spec) {
906 0 0 if (git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote) < 0)
909 0 0 if (git_vector_init(out, heads_len, remote_head_cmp) < 0)
912 0 0 for (i = 0; i < heads_len; i++) {
913 0 0 if (git_vector_insert(out, heads[i]) < 0)
929 0 0 assert(remote);
931 0 0 if (!remote->repo) {
936 0 0 if (opts) {
937 0 0 GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
940 0 0 GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
944 0 0 if (!git_remote_connected(remote) &&
0 0 if (!git_remote_connected(remote) &&
948 0 0 if (ls_to_vector(&refs, remote) < 0)
951 0 0 if ((git_vector_init(&specs, 0, NULL)) < 0)
955 0 0 if (!refspecs || !refspecs->count) {
0 0 if (!refspecs || !refspecs->count) {
958 0 0 for (i = 0; i < refspecs->count; i++) {
959 0 0 if ((error = add_refspec_to(&specs, refspecs->strings[i], true)) < 0)
968 0 0 if ((error = dwim_refspecs(&remote->passive_refspecs, &remote->refspecs, &refs)) < 0)
978 0 0 if (error < 0)
981 0 0 if (remote->push) {
986 0 0 if ((error = git_fetch_negotiate(remote, opts)) < 0)
1011 0 0 if (opts) {
1012 0 0 GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1017 0 0 GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
1022 0 0 if ((error = git_remote__connect(remote, GIT_DIRECTION_FETCH, cbs, &conn)) != 0)
1031 0 0 if (error != 0)
1035 0 0 if (reflog_message)
1038 0 0 git_buf_printf(&reflog_msg_buf, "fetch %s",
1045 0 0 if (error < 0)
1048 0 0 if (opts && opts->prune == GIT_FETCH_PRUNE)
0 0 if (opts && opts->prune == GIT_FETCH_PRUNE)
1050 0 0 else if (opts && opts->prune == GIT_FETCH_PRUNE_UNSPECIFIED && remote->prune_refs)
0 0 else if (opts && opts->prune == GIT_FETCH_PRUNE_UNSPECIFIED && remote->prune_refs)
0 0 else if (opts && opts->prune == GIT_FETCH_PRUNE_UNSPECIFIED && remote->prune_refs)
1052 0 0 else if (opts && opts->prune == GIT_FETCH_NO_PRUNE)
0 0 else if (opts && opts->prune == GIT_FETCH_NO_PRUNE)
1057 0 0 if (prune)
1068 0 0 assert(update_heads && fetchspec_src);
0 0 assert(update_heads && fetchspec_src);
1072 0 0 git_vector_foreach(update_heads, i, remote_ref) {
1073 0 0 if (strcmp(remote_ref->name, fetchspec_src) == 0) {
1092 0 0 !git_remote_name(remote) ||
1093 0 0 (error = git_branch_upstream_remote(&upstream_remote, repo, ref_name) < 0) ||
1094 0 0 git__strcmp(git_remote_name(remote), git_buf_cstr(&upstream_remote)) ||
1095 0 0 (error = git_branch_upstream_name(&upstream_name, repo, ref_name)) < 0 ||
1096 0 0 !git_refspec_dst_matches(spec, git_buf_cstr(&upstream_name)) ||
1099 0 0 if (error == GIT_ENOTFOUND) {
1122 0 0 assert(out && spec && ref);
0 0 assert(out && spec && ref);
0 0 assert(out && spec && ref);
1129 0 0 if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
0 0 if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
1136 0 0 if ((error = ref_to_update(&update, &remote_name, remote, spec, ref_name)) < 0)
1139 0 0 if (update)
1159 0 0 assert(remote);
1162 0 0 if (update_heads->length == 0)
1165 0 0 if (git_vector_init(&fetchhead_refs, update_heads->length, git_fetchhead_ref_cmp) < 0)
1172 0 0 if (git_refspec_is_wildcard(spec)) {
1173 0 0 if ((error = git_reference_lookup(&head_ref, remote->repo, GIT_HEAD_FILE)) < 0 ||
0 0 if ((error = git_reference_lookup(&head_ref, remote->repo, GIT_HEAD_FILE)) < 0 ||
1178 0 0 if ((error = remote_head_for_fetchspec_src(&merge_remote_ref, update_heads, git_refspec_src(spec))) < 0)
1183 0 0 git_vector_foreach(update_heads, i, remote_ref) {
1187 0 0 !git_refspec_src_matches(spec, remote_ref->name) &&
1191 0 0 if (git_fetchhead_ref_create(&fetchhead_ref,
1198 0 0 if (git_vector_insert(&fetchhead_refs, fetchhead_ref) < 0)
1205 0 0 for (i = 0; i < fetchhead_refs.length; ++i)
1224 0 0 if ((error = git_reference_list(&arr, remote->repo)) < 0)
1227 0 0 for (i = 0; i < arr.count; i++) {
1231 0 0 if (!git_remote__matching_dst_refspec(remote, refname))
1235 0 0 GIT_ERROR_CHECK_ALLOC(refname_dup);
1237 0 0 if ((error = git_vector_insert(candidates, refname_dup)) < 0)
1264 0 0 if (callbacks)
1265 0 0 GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1267 0 0 if ((error = ls_to_vector(&remote_refs, remote)) < 0)
1272 0 0 if ((error = prune_candidates(&candidates, remote)) < 0)
1279 0 0 git_vector_foreach(&candidates, i, refname) {
1280 0 0 git_vector_foreach(&remote->active_refspecs, j, spec) {
1286 0 0 if (!git_refspec_dst_matches(spec, refname))
1289 0 0 if ((error = git_refspec_rtransform(&buf, spec, refname)) < 0)
1296 0 0 if (error < 0 && error != GIT_ENOTFOUND)
0 0 if (error < 0 && error != GIT_ENOTFOUND)
1299 0 0 if (error == GIT_ENOTFOUND)
1303 0 0 if ((error = git_vector_set((void **) &src_name, &candidates, i, NULL)) < 0)
1317 0 0 git_vector_foreach(&candidates, i, refname) {
1321 0 0 if (refname == NULL)
1326 0 0 if (error == GIT_ENOTFOUND)
1329 0 0 if (error < 0)
1332 0 0 if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
1340 0 0 if (error < 0)
1343 0 0 if (callbacks && callbacks->update_tips)
0 0 if (callbacks && callbacks->update_tips)
1346 0 0 if (error < 0)
1375 0 0 assert(remote);
1377 0 0 if (git_repository_odb__weakptr(&odb, remote->repo) < 0)
1380 0 0 if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
1384 0 0 if (git_vector_init(&update_heads, 16, NULL) < 0)
1387 0 0 for (; i < refs->length; ++i) {
1393 0 0 if (!git_reference_is_valid_name(head->name))
1397 0 0 if (git_refspec_src_matches(&tagspec, head->name)) {
1398 0 0 if (tagopt != GIT_REMOTE_DOWNLOAD_TAGS_NONE) {
1400 0 0 if (tagopt == GIT_REMOTE_DOWNLOAD_TAGS_AUTO)
1404 0 0 if (git_buf_puts(&refname, head->name) < 0)
1410 0 0 if (!autotag && git_refspec_src_matches(spec, head->name)) {
0 0 if (!autotag && git_refspec_src_matches(spec, head->name)) {
1411 0 0 if (spec->dst) {
1412 0 0 if (git_refspec_transform(&refname, spec, head->name) < 0)
1419 0 0 if ((error = git_vector_insert(&update_heads, head)) < 0)
1427 0 0 if (git_buf_len(&refname) == 0) {
1432 0 0 if (autotag && !git_odb_exists(odb, &head->oid))
0 0 if (autotag && !git_odb_exists(odb, &head->oid))
1435 0 0 if (!autotag && git_vector_insert(&update_heads, head) < 0)
0 0 if (!autotag && git_vector_insert(&update_heads, head) < 0)
1439 0 0 if (error < 0 && error != GIT_ENOTFOUND)
0 0 if (error < 0 && error != GIT_ENOTFOUND)
1442 0 0 if (error == GIT_ENOTFOUND) {
1445 0 0 if (autotag && git_vector_insert(&update_heads, head) < 0)
0 0 if (autotag && git_vector_insert(&update_heads, head) < 0)
1449 0 0 if (!git_oid__cmp(&old, &head->oid))
1456 0 0 if (error == GIT_EEXISTS)
1459 0 0 if (error < 0)
1464 0 0 if (callbacks && callbacks->update_tips != NULL) {
0 0 if (callbacks && callbacks->update_tips != NULL) {
1465 0 0 if (callbacks->update_tips(refname.ptr, &old, &head->oid, callbacks->payload) < 0)
1470 0 0 if (update_fetchhead &&
0 0 if (update_fetchhead &&
1510 0 0 for (; i < refs->length; i++) {
1513 0 0 if (!git_reference_is_valid_name(head->name))
1516 0 0 for (; j < active->length; j++) {
1519 0 0 if (!git_refspec_src_matches(spec, head->name))
1522 0 0 for (; k < passive->length; k++) {
1525 0 0 if (!git_refspec_src_matches(passive_spec, head->name))
1556 0 0 while ((error = next_head(remote, refs, &spec, &head, &i, &j, &k)) == 0) {
1567 0 0 if ((error = git_refspec_transform(&refname, spec, head->name)) < 0)
1571 0 0 if (error < 0 && error != GIT_ENOTFOUND)
0 0 if (error < 0 && error != GIT_ENOTFOUND)
1574 0 0 if (!git_oid_cmp(&old, &head->oid))
1578 0 0 if (error)
1583 0 0 if (error < 0)
1586 0 0 if (callbacks && callbacks->update_tips != NULL) {
0 0 if (callbacks && callbacks->update_tips != NULL) {
1587 0 0 if (callbacks->update_tips(refname.ptr, &old, &head->oid, callbacks->payload) < 0)
1592 0 0 if (error == GIT_ITEROVER)
1605 0 0 if ((error = git_buf_joinpath(&path, gitdir, GIT_FETCH_HEAD_FILE)) < 0)
1628 0 0 if (remote->push) {
1632 0 0 if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
1636 0 0 if ((error = ls_to_vector(&refs, remote)) < 0)
1639 0 0 if (download_tags == GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED)
1644 0 0 if ((error = truncate_fetch_head(git_repository_path(remote->repo))) < 0)
1647 0 0 if (tagopt == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
1648 0 0 if ((error = update_tips_for_spec(remote, callbacks, update_fetchhead, tagopt, &tagspec, &refs, reflog_message)) < 0)
1652 0 0 git_vector_foreach(&remote->active_refspecs, i, spec) {
1653 0 0 if (spec->push)
1656 0 0 if ((error = update_tips_for_spec(remote, callbacks, update_fetchhead, tagopt, spec, &refs, reflog_message)) < 0)
1661 0 0 if (remote->passed_refspecs)
1672 0 4 assert(remote);
1674 2 2 if (!remote->transport || !remote->transport->is_connected)
0 2 if (!remote->transport || !remote->transport->is_connected)
1683 0 0 assert(remote);
1685 0 0 if (remote->transport && remote->transport->cancel)
0 0 if (remote->transport && remote->transport->cancel)
1693 0 0 assert(remote);
1695 0 0 if (git_remote_connected(remote))
1703 4 9 if (remote == NULL)
1706 0 9 if (remote->transport != NULL) {
1740 7 3 if (!strcmp(&name[namelen - 4], ".url"))
1744 0 10 GIT_ERROR_CHECK_ALLOC(remote_name);
1755 0 3 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
1758 0 3 if ((error = git_vector_init(&list, 4, git__strcmp_cb)) < 0)
1764 0 3 if (error < 0) {
1779 0 0 assert(remote);
1794 0 0 assert(repo && remote);
0 0 assert(repo && remote);
1796 0 0 if ((error = ensure_remote_name_is_valid(remote)) < 0)
1799 0 0 if ((error = git_repository_config__weakptr(&config, repo)) < 0)
1802 0 0 if ((error = git_buf_printf(&var, CONFIG_TAGOPT_FMT, remote)))
1814 0 0 if (error == GIT_ENOTFOUND)
1840 0 2 if (git_buf_printf(&old_section_name, "remote.%s", old_name) < 0)
1847 1 1 error = git_config_rename_section(
1871 0 0 if (strcmp(entry->value, data->old_remote_name))
1886 0 1 if ((error = git_repository_config__weakptr(&data.config, repo)) < 0)
1909 0 0 if ((error = git_buf_printf(&namespace, GIT_REFS_REMOTES_DIR "%s/", new_remote_name)) < 0)
1914 0 0 if ((error = git_buf_puts(&new_name, git_reference_name(reference_in) + pfx_len)) < 0)
1917 0 0 if ((error = git_buf_printf(&log_message,
1922 0 0 if ((error = git_reference_rename(&ref, reference_in, git_buf_cstr(&new_name), 1,
1926 0 0 if (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC)
1931 0 0 if ((error = git_buf_printf(&old_namespace, GIT_REFS_REMOTES_DIR "%s/", old_remote_name)) < 0)
1934 0 0 if (git__prefixcmp(target, old_namespace.ptr))
1939 0 0 if ((error = git_buf_puts(&new_name, target + pfx_len)) < 0)
1967 0 1 if ((error = git_buf_printf(&buf, GIT_REFS_REMOTES_DIR "%s/*", old_name)) < 0)
1973 0 1 if (error < 0)
1976 0 1 while ((error = git_reference_next(&ref, iter)) == 0) {
1977 0 0 if ((error = rename_one_remote_reference(ref, old_name, new_name)) < 0)
1983 0 1 return (error == GIT_ITEROVER) ? 0 : error;
1994 0 1 if ((error = git_repository_config__weakptr(&config, remote->repo)) < 0)
1997 0 1 if ((error = git_vector_init(problems, 1, NULL)) < 0)
2000 0 1 if ((error = default_fetchspec_for_name(&base, remote->name)) < 0)
2003 1 1 git_vector_foreach(&remote->refspecs, i, spec) {
2004 0 1 if (spec->push)
2008 0 1 if (strcmp(git_buf_cstr(&base), spec->string)) {
2012 0 0 GIT_ERROR_CHECK_ALLOC(dup);
2014 0 0 if ((error = git_vector_insert(problems, dup)) < 0)
2032 0 1 if ((error = git_config_set_string(
2041 0 1 if (error < 0) {
2043 0 0 git_vector_foreach(problems, i, str)
2058 1 0 assert(out && repo && name && new_name);
1 0 assert(out && repo && name && new_name);
1 0 assert(out && repo && name && new_name);
0 1 assert(out && repo && name && new_name);
2060 0 1 if ((error = git_remote_lookup(&remote, repo, name)) < 0)
2063 0 1 if ((error = ensure_remote_name_is_valid(new_name)) < 0)
2066 0 1 if ((error = ensure_remote_doesnot_exist(repo, new_name)) < 0)
2069 0 1 if ((error = rename_remote_config_section(repo, name, new_name)) < 0)
2072 0 1 if ((error = update_branch_remote_config_entry(repo, name, new_name)) < 0)
2075 0 1 if ((error = rename_remote_references(repo, name, new_name)) < 0)
2078 0 1 if ((error = rename_fetch_refspecs(&problem_refspecs, remote, new_name)) < 0)
2085 0 1 if (error < 0)
2099 26 0 if (!remote_name || *remote_name == '\0')
0 26 if (!remote_name || *remote_name == '\0')
2117 0 0 git_vector_foreach(&remote->active_refspecs, i, spec) {
2118 0 0 if (spec->push)
2121 0 0 if (git_refspec_src_matches(spec, refname))
2133 0 0 git_vector_foreach(&remote->active_refspecs, i, spec) {
2134 0 0 if (spec->push)
2137 0 0 if (git_refspec_dst_matches(spec, refname))
2161 0 0 if (git_vector_init(&refspecs, remote->refspecs.length, NULL) < 0)
2164 0 0 git_vector_foreach(&remote->refspecs, i, spec) {
2165 0 0 if (spec->push != push)
2168 0 0 if ((dup = git__strdup(spec->string)) == NULL)
2171 0 0 if (git_vector_insert(&refspecs, dup) < 0) {
2210 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
2224 0 0 assert(dot);
2240 0 1 if ((error = git_repository_config__weakptr(&config, repo)) < 0)
2243 0 1 if ((error = git_config_iterator_glob_new(&iter, config, "branch\\..+\\.remote")) < 0)
2247 0 1 while ((error = git_config_next(&entry, iter)) == 0) {
2251 0 0 if (strcmp(remote_name, entry->value))
2257 0 0 if (git_buf_printf(&buf, "branch.%.*s.merge", (int)branch_len, branch) < 0)
2260 0 0 if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
2261 0 0 if (error != GIT_ENOTFOUND)
2267 0 0 if (git_buf_printf(&buf, "branch.%.*s.remote", (int)branch_len, branch) < 0)
2270 0 0 if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
2271 0 0 if (error != GIT_ENOTFOUND)
2277 1 0 if (error == GIT_ITEROVER)
2294 0 1 if ((error = git_vector_init(&refs, 8, NULL)) < 0)
2297 0 1 if ((error = git_reference_iterator_new(&iter, repo)) < 0)
2300 2 1 while ((error = git_reference_next_name(&name, iter)) == 0) {
2301 2 0 if (!git_refspec_dst_matches(spec, name))
2305 0 0 if (!dup) {
2310 0 0 if ((error = git_vector_insert(&refs, dup)) < 0)
2313 1 0 if (error == GIT_ITEROVER)
2315 0 1 if (error < 0)
2318 0 1 git_vector_foreach(&refs, i, name) {
2319 0 0 if ((error = git_reference_remove(repo, name)) < 0)
2325 0 1 git_vector_foreach(&refs, i, dup) {
2339 0 1 if ((error = git_remote_lookup(&remote, repo, remote_name)) < 0)
2343 1 1 for (i = 0; i < count; i++) {
2347 0 1 if (refspec == NULL)
2350 0 1 if ((error = remove_refs(repo, refspec)) < 0)
2362 1 0 assert(repo && name);
0 1 assert(repo && name);
2364 1 0 if ((error = remove_branch_config_related_entries(repo, name)) < 0 ||
1 0 if ((error = remove_branch_config_related_entries(repo, name)) < 0 ||
2365 0 1 (error = remove_remote_tracking(repo, name)) < 0 ||
2380 0 0 assert(out);
2382 0 0 if ((error = git_remote_ls(&heads, &heads_len, remote)) < 0)
2385 0 0 if (heads_len == 0)
2388 0 0 if (strcmp(heads[0]->name, GIT_HEAD_FILE))
2393 0 0 if (heads[0]->symref_target)
2403 0 0 for (i = 1; i < heads_len; i++) {
2404 0 0 if (git_oid_cmp(head_id, &heads[i]->oid))
2407 0 0 if (git__prefixcmp(heads[i]->name, GIT_REFS_HEADS_DIR))
2410 0 0 if (!guess) {
2415 0 0 if (!git__strcmp(GIT_REFS_HEADS_MASTER_FILE, heads[i]->name)) {
2421 0 0 if (!guess)
2436 0 2 assert(remote);
2438 0 2 if (!remote->repo) {
2443 2 0 if (opts) {
2449 2 0 if (!git_remote_connected(remote) &&
0 2 if (!git_remote_connected(remote) &&
2454 0 2 if ((error = dwim_refspecs(&remote->active_refspecs, &remote->refspecs, &remote->refs)) < 0)
2457 0 2 if (remote->push) {
2462 0 2 if ((error = git_push_new(&remote->push, remote)) < 0)
2467 2 0 if (opts && (error = git_push_set_options(push, opts)) < 0)
0 2 if (opts && (error = git_push_set_options(push, opts)) < 0)
2470 2 0 if (refspecs && refspecs->count > 0) {
2 0 if (refspecs && refspecs->count > 0) {
2471 2 2 for (i = 0; i < refspecs->count; i++) {
2472 0 2 if ((error = git_push_add_refspec(push, refspecs->strings[i])) < 0)
2476 0 0 git_vector_foreach(&remote->refspecs, i, spec) {
2477 0 0 if (!spec->push)
2479 0 0 if ((error = git_push_add_refspec(push, spec->string)) < 0)
2484 0 2 if ((error = git_push_finish(push, cbs)) < 0)
2487 2 0 if (cbs && cbs->push_update_reference &&
1 1 if (cbs && cbs->push_update_reference &&
0 1 if (cbs && cbs->push_update_reference &&
2502 0 0 assert(remote);
2504 0 0 if (!remote->repo) {
2509 0 0 if (opts) {
2510 0 0 GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2513 0 0 GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
2517 0 0 assert(remote);
2519 0 0 if ((error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, proxy, custom_headers)) < 0)
2522 0 0 if ((error = git_remote_upload(remote, refspecs, opts)) < 0)
2545 0 18 assert(config);
2546 0 18 assert(url);
2547 3 15 assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
0 3 assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
2551 15 3 if (direction == GIT_DIRECTION_FETCH) {
2559 0 18 if (git_config_iterator_glob_new(&iter, config, regexp) < 0)
2563 0 18 while (git_config_next(&entry, iter) == 0) {
2567 0 0 if (git__prefixcmp(url, entry->value))
2571 0 0 if ((n = strlen(entry->value)) <= match_length)
2586 18 0 if (match_length == 0)