Merge pull request #5115 from mitocw/cg/bugfix/add_git_clean

Fixes git export to support repositories with dots in their name and cleans export repo
This commit is contained in:
Sarina Canelake
2014-09-09 09:15:33 -04:00
2 changed files with 60 additions and 16 deletions

View File

@@ -111,6 +111,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
['git', 'fetch', 'origin'],
['git', 'reset', '--hard', 'origin/{0}'.format(branch)],
['git', 'pull'],
['git', 'clean', '-d', '-f'],
]
else:
cmds = [['git', 'clone', repo]]
@@ -126,7 +127,7 @@ def export_to_git(course_id, repo, user='', rdir=None):
# export course as xml before commiting and pushing
root_dir = os.path.dirname(rdirp)
course_dir = os.path.splitext(os.path.basename(rdirp))[0]
course_dir = os.path.basename(rdirp).rsplit('.git', 1)[0]
try:
export_to_xml(modulestore(), contentstore(), course_id,
root_dir, course_dir)