unfoldingWord / translationCore

Repository for the desktop application translationCore

Home Page:https://www.translationcore.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes new repos are created with default branch main instead of master

PhotoNomad0 opened this issue · comments

Story Explanation

User Story

Sometimes new repos are created with default branch main instead of master, and this cause problems since all our apps presume the default branch as being master. This appears to be the outcome of the git app changing to creating new repos with default branch named main.

Changes needed:

  • when a repo is first initialized with git, pass parameters to make sure it is initialized with master as the default branch:

    • first we try passing the option to set the initial branch name to master, and if that parameter is not supported by the old version of git installed on the system, then commit changes and rename the branch to master if necessary.
    • when opening a repo, make sure the current branch is master. If it is not the current branch, check if master branch already exists:
      • if master branch does not exist, commit changes and rename current branch to master
      • if master branch already exists, commit changes and change branch to master.
  • other changes:

    • add logging of git version currently on system

Features / Specifications

  • [ ]
  • [ ]
  • [ ]

Definition of Done

  • [ ]
  • [ ]
  • [ ]

Additional Context

Mockups

Notes - testing on MacOS or in Windows:

  • to configure your system to default to branch name of main:
    • configure system to default to main branch: git config --global init.defaultBranch main
    • create a new test repo (if there already is a test folder you will have to delete it):
mkdir test
cd test
touch stuff.txt
git init
git add *
git commit -m "first commit"
  • now verify that the repo was created with default branch as main: git branch | tail
  • you can delete the test folder now.

Later - to restore your system to default to branch name of master do: git config --global init.defaultBranch master

@elsylambert - fixes are in translationCore 3.5.0 (a0d8658) - translationCore 3.5.0 (5951b4e)
For testing, first follow steps above (see Notes - testing on MacOS or in Windows:) to configure your system to default to main as the branch name.

Check that we can recover broken projects:

  • using old tCore:
    • do local USFM import to create a new project
    • upload project to DCS. Will get an erroneous upload error cannot be uploaded because there have been changes to the translation of that project on your Door43 account.
    • if you look at the project on DCS, it will be empty
    • close tCore
  • using new tCore:
    • open same project as above
    • upload project to DCS and it should succeed
    • if you look at the project on DCS, it will not be empty

Check that new projects are created in master branch:

  • using new tCore:
    • do local USFM import to create a new project
    • upload project to DCS and it should succeed
    • if you look at the project on DCS, it will not be empty

@elsylambert Don't know how this did not get into QA

Tested in Windows machine with Version 3.5.0 (30831db). Looks good and works as expected.