[sysadmin-bin] Follow project's default branch for GitHub mirror
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Follow project's default branch for GitHub mirror
- Date: Tue, 14 Jul 2020 11:02:23 +0000 (UTC)
commit b7bdc529accffca658fb4cf64ca61022ce068f29
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Tue Jul 14 13:00:18 2020 +0200
Follow project's default branch for GitHub mirror
Initially we tried to sabotage GitHub mirrors SEO by not using master
branch, but since then GitHub's robots.txt was changed to index all
branches.
git/post-receive-mirror-github | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index afa19d6..d48b912 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -224,21 +224,12 @@ def main():
if github_settings['homepage'] != doap_settings['homepage']:
gh.update_github_repo(repo_name, 'homepage', doap_settings["homepage"])
- if doap_settings['default_branch'] == 'mainline':
- push_command = "git push --mirror git github com:{}/{}".format(gh.organization, github_repo_name)
- else:
- push_command_tpl = "git push --force --tags git github com:{}/{} {}:mainline {}"
- refs = ["\"refs/heads/{}\"".format(branch) for branch in doap_settings['branches'] if branch not in
("master", "mainline")]
- push_command = push_command_tpl.format(gh.organization, github_repo_name,
doap_settings['default_branch'], " ".join(refs))
-
+ push_command = "git push --mirror git github com:{}/{}".format(gh.organization, github_repo_name)
run_command(push_command)
- if github_settings['default_branch'] != "mainline":
- gh.update_github_repo(repo_name, 'default_branch', "mainline")
-
- github_branches = gh.get_branches(repo_name)
- if 'master' in github_branches:
- run_command("git push --force git github com:{}/{} :master".format(gh.organization,
github_repo_name))
+ gh.update_github_repo(repo_name, 'default_branch', doap_settings['default_branch'])
+ if doap_settings['default_branch'] != 'mainline':
+ run_command("git push --force git github com:{}/{} :mainline".format(gh.organization,
github_repo_name))
for org in ADDITIONAL_ORGANIZATIONS.get(repo_name, []):
run_command("git push --mirror git github com:{}/{}".format(org, github_repo_name))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]