Commit b66fe6ff authored by Claude Paroz's avatar Claude Paroz

Fixes #110 - Set proper directory when cloning a new git repo

Thanks Piotr Drąg for the report.
parent 17a8a290
......@@ -51,7 +51,7 @@ class GitRepo(RepoBase):
# We are assuming here that master is the first branch created
if self.branch.name == "master":
commands = [
['git', 'clone', self.branch.module.vcs_root, str(self.branch.co_path.parent)],
['git', 'clone', self.branch.module.vcs_root, str(self.branch.co_path)],
['git', 'remote', 'update'],
['git', 'checkout', self.branch.name],
]
......
......@@ -96,6 +96,14 @@ class ModuleTestCase(TestCase):
response = self.client.get(reverse('module', args=[self.mod.name]))
self.assertContains(response, "Sorry, no known locations to report bugs for this module.")
@test_scratchdir
def test_first_branch_creation(self):
mod = Module.objects.create(name='eog', vcs_type='git', vcs_root='https://gitlab.gnome.org/GNOME/eog.git')
br = Branch(module=mod, name='master')
with patch_shell_command() as cmds:
br.checkout()
self.assertTrue('git clone https://gitlab.gnome.org/GNOME/eog.git %s/git/eog' % settings.SCRATCHDIR in cmds)
def test_branch_methods(self):
branch = Branch(module=self.mod, name='master')
self.assertTrue(branch.is_head())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment