[damned-lies] Fixes #110 - Set proper directory when cloning a new git repo



commit b66fe6ff99168827521fe15eb6ec944a36612fc4
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Oct 26 09:13:19 2018 +0200

    Fixes #110 - Set proper directory when cloning a new git repo
    
    Thanks Piotr Drąg for the report.

 stats/repos.py       | 2 +-
 stats/tests/tests.py | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/stats/repos.py b/stats/repos.py
index 8d3d6fa6..c35d44b2 100644
--- a/stats/repos.py
+++ b/stats/repos.py
@@ -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],
             ]
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index 06d76f75..d75e9bf2 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -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())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]