From 348bee7d089b2e92d139a484e9bf8e63cfee3d96 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: May 30 2016 10:08:26 +0000 Subject: use tmp when creating repo to add README file to We have to create a non-bare repo to add the new README file to when creating the README automatically when creating a project. Previously this was being created and then removed from the main repos directory, but this commit uses the python module tempfile to use temp. --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index c998f7d..8f36cd7 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1016,7 +1016,7 @@ def new_project(session, user, name, blacklist, allowed_prefix, if not add_readme: pygit2.init_repository(gitrepo, bare=True) else: - temp_gitrepo_path = os.path.join(gitfolder, '%s' % name) + temp_gitrepo_path = tempfile.mkdtemp(prefix='pagure-') temp_gitrepo = pygit2.init_repository(temp_gitrepo_path, bare=False) author = pygit2.Signature(userobj.fullname, userobj.default_email) f = open(os.path.join(temp_gitrepo.workdir,"README.md"), 'w')