diff --git a/pungi/wrappers/scm.py b/pungi/wrappers/scm.py index 1f464295..a099a902 100644 --- a/pungi/wrappers/scm.py +++ b/pungi/wrappers/scm.py @@ -168,6 +168,8 @@ class GitWrapper(ScmBase): % (e, e.output) ) try: + # Re-run git init in case of previous failure breaking .git dir + run(["git", "init"], workdir=destdir) run(["git", "remote", "add", "origin", repo], workdir=destdir) self.retry_run(["git", "remote", "update", "origin"], workdir=destdir) run(["git", "checkout", branch], workdir=destdir) diff --git a/tests/test_scm.py b/tests/test_scm.py index 1cb7f35f..ae18985f 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -192,6 +192,7 @@ class GitSCMTestCase(SCMBaseTest): "git://example.com/git/repo.git", "master", ], + ["git", "init"], ["git", "remote", "add", "origin", url], ["git", "remote", "update", "origin"], ["git", "checkout", "master"],