Stop refering to master as the de-facto default branch in docs

This commit is contained in:
Markus Olsson 2020-10-15 14:47:44 +02:00
parent a588bbf96a
commit 4aed2523d4
14 changed files with 34 additions and 24 deletions

View file

@ -9,7 +9,7 @@ import * as Path from 'path'
* Will throw an error if the entry is not found in the packed-refs file
*
* @param gitDir The path to the Git repository's .git directory
* @param ref A qualified git ref such as 'refs/heads/master'
* @param ref A qualified git ref such as 'refs/heads/main'
*/
function readPackedRefsFile(gitDir: string, ref: string) {
const packedRefsPath = Path.join(gitDir, 'packed-refs')
@ -43,7 +43,7 @@ function readPackedRefsFile(gitDir: string, ref: string) {
* Will throw an error for unborn HEAD.
*
* @param gitDir The path to the Git repository's .git directory
* @param ref A qualified git ref such as 'HEAD' or 'refs/heads/master'
* @param ref A qualified git ref such as 'HEAD' or 'refs/heads/main'
* @returns The ref SHA
*/
function revParse(gitDir: string, ref: string): string {

View file

@ -353,7 +353,7 @@ export interface IAPIBranch {
/**
* The name of the branch stored on the remote.
*
* NOTE: this is NOT a fully-qualified ref (i.e. `refs/heads/master`)
* NOTE: this is NOT a fully-qualified ref (i.e. `refs/heads/main`)
*/
readonly name: string
/**

View file

@ -437,9 +437,14 @@ export interface IBranchesState {
readonly tip: Tip
/**
* The default branch for a given repository. Most commonly this
* will be the 'master' branch but GitHub users are able to change
* their default branch in the web UI.
* The default branch for a given repository. Historically it's been
* common to use 'master' as the default branch but as of September 2020
* GitHub Desktop and GitHub.com default to using 'main' as the default branch.
*
* GitHub Desktop users are able to configure the `init.defaultBranch` Git
* setting in preferences.
*
* GitHub.com users are able to change their default branch in the web UI.
*/
readonly defaultBranch: Branch | null
@ -682,9 +687,14 @@ export interface ICompareState {
readonly recentBranches: ReadonlyArray<Branch>
/**
* The default branch for a given repository. Most commonly this
* will be the 'master' branch but GitHub users are able to change
* their default branch in the web UI.
* The default branch for a given repository. Historically it's been
* common to use 'master' as the default branch but as of September 2020
* GitHub Desktop and GitHub.com default to using 'main' as the default branch.
*
* GitHub Desktop users are able to configure the `init.defaultBranch` Git
* setting in preferences.
*
* GitHub.com users are able to change their default branch in the web UI.
*/
readonly defaultBranch: Branch | null

View file

@ -35,7 +35,7 @@ export interface IDatabaseProtectedBranch {
/**
* The branch name associated with the branch protection settings
*
* NOTE: this is NOT a fully-qualified ref (i.e. `refs/heads/master`)
* NOTE: this is NOT a fully-qualified ref (i.e. `refs/heads/main`)
*/
readonly name: string
}

View file

@ -149,7 +149,7 @@ export async function getBranchesPointedAt(
{
// - 1 is returned if a common ancestor cannot be resolved
// - 129 is returned if ref is malformed
// "warning: ignoring broken ref refs/remotes/origin/master."
// "warning: ignoring broken ref refs/remotes/origin/main."
successExitCodes: new Set([0, 1, 129]),
}
)

View file

@ -67,7 +67,7 @@ export async function getMergeBase(
{
// - 1 is returned if a common ancestor cannot be resolved
// - 128 is returned if a ref cannot be found
// "warning: ignoring broken ref refs/remotes/origin/master."
// "warning: ignoring broken ref refs/remotes/origin/main."
successExitCodes: new Set([0, 1, 128]),
}
)

View file

@ -6,8 +6,8 @@ import { Repository } from '../../models/repository'
* is ambiguous are handled.
*
* Examples:
* - master -> refs/heads/master
* - heads/Microsoft/master -> refs/heads/Microsoft/master
* - main -> refs/heads/main
* - heads/Microsoft/main -> refs/heads/Microsoft/main
*
* @param branch The local branch name
*/

View file

@ -44,7 +44,7 @@ export interface IDailyMeasures {
/** The number of times a branch is compared to an arbitrary branch */
readonly branchComparisons: number
/** The number of times a branch is compared to `master` */
/** The number of times a branch is compared to the default branch */
readonly defaultBranchComparisons: number
/** The number of times a merge is initiated in the `compare` sidebar */

View file

@ -644,7 +644,7 @@ export class StatsStore implements IStatsStore {
}))
}
/** Record that a branch comparison has been made to the `master` branch */
/** Record that a branch comparison has been made to the default branch */
public recordDefaultBranchComparison(): Promise<void> {
return this.updateDailyMeasures(m => ({
defaultBranchComparisons: m.defaultBranchComparisons + 1,

View file

@ -527,7 +527,7 @@ export class GitStore extends BaseStore {
) {
// strip out everything related to the remote because this
// is likely to be a tracked branch locally
// e.g. `master`, `develop`, etc
// e.g. `main`, `develop`, etc
return match.substr(remoteNamespace.length)
}
}
@ -567,7 +567,7 @@ export class GitStore extends BaseStore {
return this._tip
}
/** The default branch, or `master` if there is no default. */
/** The default branch or null if the default branch could not be inferred. */
public get defaultBranch(): Branch | null {
return this._defaultBranch
}

View file

@ -190,7 +190,7 @@ export class BranchPruner {
[...recentlyCheckedOutBranches.keys()].map(formatAsLocalRef)
)
// get the locally cached branches of remotes (ie `remotes/origin/master`)
// get the locally cached branches of remotes (ie `remotes/origin/main`)
const remoteBranches = (
await getBranches(this.repository, `refs/remotes/`)
).map(b => formatAsLocalRef(b.name))

View file

@ -62,8 +62,8 @@ export class Branch {
/**
* A branch as loaded from Git.
*
* @param name The short name of the branch. E.g., `master`.
* @param upstream The remote-prefixed upstream name. E.g., `origin/master`.
* @param name The short name of the branch. E.g., `main`.
* @param upstream The remote-prefixed upstream name. E.g., `origin/main`.
* @param tip Basic information (sha and author) of the latest commit on the branch.
* @param type The type of branch, e.g., local or remote.
*/

View file

@ -18,8 +18,8 @@ export interface IUnbornRepository {
/**
* The symbolic reference that the unborn repository points to currently.
*
* Typically this will be "master" but a user can easily create orphaned
* branches externally.
* Typically this will be whatever `init.defaultBranch` is set to but a user
* can create orphaned branches themselves.
*/
readonly ref: string
}

View file

@ -151,7 +151,7 @@ export class Git extends React.Component<IGitProps, IGitState> {
*
* We don't want to call this handler on changes to the text box since that
* will cause the text box to be hidden if the user types a branch name
* that starts with one of the suggested branch names (e.g `mastera`).
* that starts with one of the suggested branch names (e.g `mainXYZ`).
*
* @param defaultBranch string the selected default branch
*/