@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user