From 55a19ffe6a1cb55e0c8a3528c989948322d5080c Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 5 Dec 2019 14:26:24 -0500 Subject: [PATCH] Fix project sync errors when project branch is commit --- awx/main/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index ca8db3480f..6be7a0d8ad 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -2214,7 +2214,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):