Skip to content

[Meta] Support "main" as a default branch name #1125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
TimidRobot opened this issue Jun 15, 2020 · 4 comments
Closed
3 tasks done

[Meta] Support "main" as a default branch name #1125

TimidRobot opened this issue Jun 15, 2020 · 4 comments
Assignees
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix good web citizen 🟩 priority: low Low priority and doesn't need to be rushed 🔒 staff only Restricted to CC staff members 🏁 status: ready for work Ready for work

Comments

@TimidRobot
Copy link
Member

TimidRobot commented Jun 15, 2020

Description

This ticket tracks the variety of changes required to support main as a default branch name for the creativecommons and cc-archive GitHub organizations.

Rationale

Master-slave is an oppressive metaphor that will and should never become fully detached from history. Aside from being unprofessional and oppressive it stifles participation

(1.1. Master-slave - Terminology, Power and Oppressive Language)

While not everyone may interpret a git master branch as representing a "master-slave" metaphor, it is not unreasonable for anyone to do so:

First appearance of "master" in git is in a CVS helper script[1]:
git/git@3e91311

Why is that branch called master? Probably because BitKeeper uses
"master" for its main branch:
http://www.bitkeeper.org/tips.html#_how_do_i_rebase_my_work_on_top_of_a_different_changeset

But maybe this "master" isn't the same one that's in "master/slave"?
See the documentation about
master/slave repositories:
https://github.com/bitkeeper-scm/bitkeeper/blob/master/doc/HOWTO.ask#L223

But repositories and branches aren't the same! They are in BitKeeper:
https://users.bitkeeper.org/t/branching-with-bk/158/2

So, yes, the "git master" branch probably isn't even a "master copy"
reference, but a straight up master/slave reference.

(Re: Replacing "master" reference in git branch names (was Re: Proposal:)

Continuing to use master as a default branch name is unwelcoming of too many. We should put our best face forward, not a face that others can easily interpret as hostility or white supremacy.

Implementation Details

  1. Identify and resolve issues that prevent main from being used a default branch name and track them, below.
  2. Project maintainers will decide per repository whether they want to move to using main and track them, below.
  3. The Creative Commons Engineering team will re-evaluate based on the experience of using main in those repositories within ~6 months (2020 end of November or beginning of December)

Prerequisites

Additional context

@TimidRobot
Copy link
Member Author

TimidRobot commented Jun 15, 2020

@kgodey kgodey added 🛠 goal: fix Bug fix and removed bug labels Sep 24, 2020
@TimidRobot TimidRobot added 🟩 priority: low Low priority and doesn't need to be rushed and removed Hacktoberfest help wanted Open to participation from the community labels Oct 23, 2020
@dhruvkb dhruvkb added the 🤖 aspect: dx Concerns developers' experience with the codebase label Oct 31, 2020
@cc-open-source-bot cc-open-source-bot added 🏷 status: label work required Needs proper labelling before it can be worked on and removed 🏷 status: label work required Needs proper labelling before it can be worked on labels Dec 2, 2020
@TimidRobot TimidRobot added 🚧 status: blocked Blocked & therefore, not ready for work and removed 🏷 status: label work required Needs proper labelling before it can be worked on labels Dec 7, 2020
@TimidRobot TimidRobot added 🏁 status: ready for work Ready for work 🔒 staff only Restricted to CC staff members and removed 🚧 status: blocked Blocked & therefore, not ready for work labels Jan 21, 2021
@TimidRobot TimidRobot added the 🕹 aspect: interface Concerns end-users' experience with the software label Jan 21, 2021
@TimidRobot
Copy link
Member Author

TimidRobot commented Apr 9, 2021

Default Branch Rename Status

cc-archive GitHub Organization

Private Repositories

All 1 private repositories are using main as the default branch name, as of 2022-04-28 16:53 UTC.

Public Repositories

All 190 public repositories are using main as the default branch name, as of 2022-04-28 16:53 UTC.

creativecommons GitHub Organization

Private Repositories

All 8 private repositories are using main as the default branch name, as of 2022-04-28 16:53 UTC.

Public Repositories

Of the 72 public repositories, there are still 4 (6%) using a deprecated default branch name, as of 2022-04-28 16:53 UTC:

Repository Default Branch
candela-utility master
creativecommons.github.io master
queulat master
rubycas-client-rails master

@TimidRobot
Copy link
Member Author

TimidRobot commented Apr 9, 2021

audit script:

#!/usr/bin/env python3
# Standard library
import datetime
import os

# Third-party
from github import Github

ORGS = ["cc-archive", "creativecommons"]
GITHUB_TOKEN = os.environ["ADMIN_GITHUB_TOKEN"]
NOW = datetime.datetime.now(datetime.timezone.utc)


def print_percent(label, repos, deprecated):
    percent = float(len(deprecated)) / float(len(repos)) * 100
    if int(percent) == 0:
        print(
            f"All {len(repos)} {label} repositories are using `main` as the"
            f" *default branch* name, as of `{NOW:%Y-%m-%d %H:%M %Z}`."
        )
        print()
        print()
    else:
        if label == "private":
            punctuation = "."
        else:
            punctuation = ":"
        print(
            f"Of the {len(repos)} {label} repositories, there are still"
            f" {len(deprecated)} ({percent:.0f}%) using a deprecated"
            f" *default branch* name, as of `{NOW:%Y-%m-%d %H:%M %Z}`"
            f"{punctuation}"
        )
        print()
    return percent


github_client = Github(GITHUB_TOKEN)
print("## *Default Branch* Rename Status")
print()
for org in ORGS:
    cc = github_client.get_organization(org)
    repos = list(cc.get_repos())
    repos_private = []
    repos_public = []
    deprecated_private = []
    deprecated_public = []
    for repo in repos:
        if repo.private:
            repos_private.append(repo.name)
            if repo.default_branch == "master":
                deprecated_private.append([repo.name, repo.default_branch])
        else:
            repos_public.append(repo.name)
            if repo.default_branch == "master":
                deprecated_public.append([repo.name, repo.default_branch])
    del repos
    deprecated_public.sort(key=lambda l: l[0].casefold())
    print(f"### [`{org}`](/{org}) GitHub Organization")
    print()
    print()
    print("#### Private Repositories")
    print()
    print_percent("private", repos_private, deprecated_private)
    print()
    print("#### Public Repositories")
    print()
    percent = print_percent("public", repos_public, deprecated_public)
    if int(percent) > 0:
        print("| Repository | Default Branch |")
        print("| ---------- | -------------- |")
        for name, branch in deprecated_public:
            link = f"[`{name}`](/{org}/{name})"
            print(f"| {link} | `{branch}` |")
        print()

@TimidRobot
Copy link
Member Author

TimidRobot commented Apr 28, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix good web citizen 🟩 priority: low Low priority and doesn't need to be rushed 🔒 staff only Restricted to CC staff members 🏁 status: ready for work Ready for work
Projects
None yet
Development

No branches or pull requests

5 participants
@kgodey @TimidRobot @dhruvkb @cc-open-source-bot and others