Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bin/git-external
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class GitExternal:
{k: v for (k, v) in config.items()
if not k.startswith('match-')})

def add_external(self, url, path, branch='master', vcs="git"):
def add_external(self, url, path, branch='main', vcs="git"):
"""Adding an external by writing it to .gitexternals.

Arguments:
Expand Down Expand Up @@ -328,7 +328,7 @@ class GitExternal:
check_call(["svn", "up"], cwd=path)
else:
cur_branch = self.get_branch_name(path)
branch = config.get("branch") or "master"
branch = config.get("branch") or "main"
if branch == cur_branch:
log.info(f"[{repo}] Updating Git external")
check_call(["git", "pull", "--ff-only"], cwd=path)
Expand Down Expand Up @@ -362,20 +362,20 @@ class GitExternal:
check_call(["svn", "checkout", config["url"],
path, ])
else:
branch = config.get("branch") or "master"
branch = config.get("branch") or "main"
log.info(f"[{repo}] Cloning Git external")
check_call(["git", "clone", config["url"], path])

cur_branch = self.get_branch_name(path)
branch = config.get('branch') or "master"
branch = config.get('branch') or "main"
if cur_branch != branch:
log.info(f"[{repo}] Switching branch {cur_branch} -> {branch}")
check_call(["git", "checkout", branch], cwd=path)

elif 'clone' in repo_only and self.is_repository(path):
if vcs == "git":
cur_branch = self.get_branch_name(path)
branch = config.get('branch') or "master"
branch = config.get('branch') or "main"
if cur_branch != branch:
log.info(f"[{repo}] Switching branch {cur_branch} -> {branch}")
check_call(["git", "checkout", branch],
Expand Down Expand Up @@ -462,7 +462,7 @@ class GitExternal:
subparser.set_defaults(func=self.cmd_add)
subparser.add_argument("URL", help="Url of the external")
subparser.add_argument("PATH", help="Path where to clone the external")
subparser.add_argument("-b", "--branch", default="master",
subparser.add_argument("-b", "--branch", default="main",
help="Branch that should be used")
vcs_group = subparser.add_mutually_exclusive_group()
vcs_group.add_argument("-s", "--svn", action='store_const',
Expand Down