Merge pull request #5460 from AlanCoding/fix_detached

Fix project sync errors when project branch is commit

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-12-06 20:04:21 +00:00 committed by GitHub
commit f0198105c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2183,7 +2183,10 @@ class RunProjectUpdate(BaseTask):
project_path = instance.project.get_project_path(check_if_exists=False)
if os.path.exists(project_path):
git_repo = git.Repo(project_path)
self.original_branch = git_repo.active_branch
if git_repo.head.is_detached:
self.original_branch = git_repo.head.commit
else:
self.original_branch = git_repo.active_branch
@staticmethod
def make_local_copy(project_path, destination_folder, scm_type, scm_revision):