Add only the origin remote to the local project
create_local_project no longer adds a github remote, with or without GitHub: a push to origin reaches GitHub through the push mirror. A github remote that already exists, such as one made by an earlier version, is left as it is, and a different origin is still refused. - Remove github_remote_url, which nothing else used - README describes the one remote and how to remove an old github remote - Tests: origin is the only remote with and without GitHub, no GitHub address in .git/config, and an existing github remote is kept Task: MIL-008#1 Task: MIL-008#2 Task: MIL-008#3
This commit is contained in:
+1
-5
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Part of create-project.sh: sourced by it, never run on its own.
|
||||
#
|
||||
# Provides: is_reused, repo_owner, repo_url, gitea_host, origin_protocol, origin_url, github_remote_url, framework_url
|
||||
# Provides: is_reused, repo_owner, repo_url, gitea_host, origin_protocol, origin_url, framework_url
|
||||
|
||||
# is_reused HOST: succeed if the existing repository on HOST will be reused.
|
||||
is_reused() {
|
||||
@@ -54,10 +54,6 @@ origin_url() {
|
||||
fi
|
||||
}
|
||||
|
||||
github_remote_url() {
|
||||
printf '%s/%s/%s.git' "${CONFIG[GITHUB_WEB_URL]}" "${PROJECT[github_owner]}" "${PROJECT[name]}"
|
||||
}
|
||||
|
||||
# framework_url: where the framework submodule comes from (always SSH).
|
||||
framework_url() {
|
||||
printf 'ssh://git@%s:%s/%s.git' "$(gitea_host)" "${CONFIG[GITEA_SSH_PORT]}" \
|
||||
|
||||
@@ -71,8 +71,10 @@ checkout_gitea_history() {
|
||||
fi
|
||||
}
|
||||
|
||||
# create_local_project: the directory, the git repository on main, the
|
||||
# remotes and, when a license applies, the license history. No commit is made.
|
||||
# create_local_project: the directory, the git repository on main, the origin
|
||||
# remote and, when a license applies, the license history. No commit is made.
|
||||
# Gitea is the only remote: a push to it reaches GitHub through the push
|
||||
# mirror, so no github remote is added (and none that exists is removed).
|
||||
create_local_project() {
|
||||
local label="Local project" dir="${PROJECT[directory]}"
|
||||
begin_step "$label"
|
||||
@@ -82,9 +84,6 @@ create_local_project() {
|
||||
git_project "$dir" symbolic-ref HEAD "refs/heads/$DEFAULT_BRANCH"
|
||||
fi
|
||||
ensure_remote "$dir" origin "$(origin_url)"
|
||||
if ((PROJECT[has_github])); then
|
||||
ensure_remote "$dir" github "$(github_remote_url)"
|
||||
fi
|
||||
if [[ -n ${PROJECT[license]} ]]; then
|
||||
checkout_gitea_history "$dir"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user