MCPcopy Create free account
hub / github.com/git/git / migrate_file

Function migrate_file

builtin/remote.c:762–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760}
761
762static int migrate_file(struct remote *remote)
763{
764 struct strbuf buf = STRBUF_INIT;
765
766 strbuf_addf(&buf, "remote.%s.url", remote->name);
767 for (size_t i = 0; i < remote->url.nr; i++)
768 repo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], "^$", 0);
769 strbuf_reset(&buf);
770 strbuf_addf(&buf, "remote.%s.push", remote->name);
771 for (int i = 0; i < remote->push.nr; i++)
772 repo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, "^$", 0);
773 strbuf_reset(&buf);
774 strbuf_addf(&buf, "remote.%s.fetch", remote->name);
775 for (int i = 0; i < remote->fetch.nr; i++)
776 repo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, "^$", 0);
777#ifndef WITH_BREAKING_CHANGES
778 if (remote->origin == REMOTE_REMOTES)
779 unlink_or_warn(repo_git_path_replace(the_repository, &buf,
780 "remotes/%s", remote->name));
781 else if (remote->origin == REMOTE_BRANCHES)
782 unlink_or_warn(repo_git_path_replace(the_repository, &buf,
783 "branches/%s", remote->name));
784#endif /* WITH_BREAKING_CHANGES */
785 strbuf_release(&buf);
786
787 return 0;
788}
789
790struct push_default_info
791{

Callers 1

mvFunction · 0.85

Calls 5

strbuf_addfFunction · 0.85
repo_config_set_multivarFunction · 0.85
unlink_or_warnFunction · 0.85
repo_git_path_replaceFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected