diff --git a/cms/djangoapps/contentstore/git_export_utils.py b/cms/djangoapps/contentstore/git_export_utils.py index ed3922aca8..31739364fd 100644 --- a/cms/djangoapps/contentstore/git_export_utils.py +++ b/cms/djangoapps/contentstore/git_export_utils.py @@ -108,7 +108,7 @@ def export_to_git(course_id, repo, user='', rdir=None): # Get current branch cmd = ['git', 'symbolic-ref', '--short', 'HEAD'] try: - branch = cmd_log(cmd, cwd).strip('\n') + branch = cmd_log(cmd, cwd).decode('utf-8').strip('\n') except subprocess.CalledProcessError as ex: log.exception(u'Failed to get branch: %r', ex.output) raise GitExportError(GitExportError.DETACHED_HEAD) @@ -146,7 +146,7 @@ def export_to_git(course_id, repo, user='', rdir=None): if not branch: cmd = ['git', 'symbolic-ref', '--short', 'HEAD'] try: - branch = cmd_log(cmd, os.path.abspath(rdirp)).strip('\n') + branch = cmd_log(cmd, os.path.abspath(rdirp)).decode('utf-8').strip('\n') except subprocess.CalledProcessError as ex: log.exception(u'Failed to get branch from freshly cloned repo: %r', ex.output) diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_git_export.py b/cms/djangoapps/contentstore/management/commands/tests/test_git_export.py index ae21e494c5..3b4fe60ae2 100644 --- a/cms/djangoapps/contentstore/management/commands/tests/test_git_export.py +++ b/cms/djangoapps/contentstore/management/commands/tests/test_git_export.py @@ -162,7 +162,7 @@ class TestGitExport(CourseTestCase): ) cwd = os.path.abspath(git_export_utils.GIT_REPO_EXPORT_DIR / 'test_bare') git_log = subprocess.check_output(['git', 'log', '-1', - '--format=%an|%ae'], cwd=cwd) + '--format=%an|%ae'], cwd=cwd).decode('utf-8') self.assertEqual(expect_string, git_log) # Make changes to course so there is something to commit @@ -177,7 +177,7 @@ class TestGitExport(CourseTestCase): self.user.email, ) git_log = subprocess.check_output( - ['git', 'log', '-1', '--format=%an|%ae'], cwd=cwd) + ['git', 'log', '-1', '--format=%an|%ae'], cwd=cwd).decode('utf-8') self.assertEqual(expect_string, git_log) def test_no_change(self):