Merge pull request 'New branch is empty' (#26) from adamm/git-importer:fix_inintial_branch into use_git_for_sha256

Reviewed-on: #26
Reviewed-by: Dirk Mueller <dirkmueller@noreply@src.opensuse.org>
This commit is contained in:
Dirk Mueller 2024-06-10 17:03:48 +02:00
commit 033b8f8cee

View File

@ -85,7 +85,7 @@ class Git:
"""Checkout into the branch HEAD"""
new_branch = False
if branch not in self.branches():
self.git_run(["branch", "-q", branch, "HEAD"])
self.git_run(["switch", "-q", "--orphan", branch])
new_branch = True
else:
ref = f"refs/heads/{branch}"