atom/github

Default branch name of new git repositories is `master`, despite init.defaultbranch settings

TomVincentUK opened this issue · 1 comments

Prerequisites

Description

When creating a new git repository via the built in Atom GUI, the default branch name is master, even though my default git branch name (init.defaultbranch) is main when invoking git from a terminal.

Steps to Reproduce

  1. Open Atom in a new directory
  2. Create a new git repository using the Create repository button
  3. Add a file and make the first commit to the repository using the Create detached commit button
  4. Check the name of the created branch

Expected behavior:

The branch created should be named to match either init.defaultbranch from the user's gitconfig, or to main (to match the default behaviour for new github repositories).

Actual behavior:

The default branch is named master

Reproduces how often:

100%

Versions

Windows 10

> atom --version

Atom    : 1.60.0
Electron: 9.4.4
Chrome  : 83.0.4103.122
Node    : 12.14.1
> apm --version
apm  2.6.2
npm  6.14.13
node 12.14.1 x64
atom 1.60.0
python 3.9.1
git 2.33.1.windows.1
visual studio

Additional Information

My Stack Overflow post on this topic: issue was reproduced on Ubuntu by other user

I don't really know my way around the code in this repo, but it looks like the default branch name "master" is hardcoded in the publishRepository() function here:
https://github.com/atom/github/blob/master/lib/views/create-dialog.js#L49-L55