[Asterisk-code-review] digium git: Fix repo creation from a working directory that ... (repotools[master])
Matt Jordan
asteriskteam at digium.com
Thu May 21 21:19:56 CDT 2015
Matt Jordan has uploaded a new change for review.
https://gerrit.asterisk.org/515
Change subject: digium_git: Fix repo creation from a working directory that is not a Git repo
......................................................................
digium_git: Fix repo creation from a working directory that is not a Git repo
A quirky bug exists in the digium_git library where cloning of a
repository to a new location fails if the class is created when the
script is invoked from a directory that is itself not a Git directory.
Prior to this patch, a Repo object was instantiated before the class
method 'clone_from' was invoked on the object. The Repo object can only
be created with no specific directory if the current working directory is a
git repo. When testing, this worked, as the scripts were invoked from
within a clone of the 'repotools' repository. However, outside of a
local Git repository, the DigiumGit class will throw an exception.
This patch modifies the code to treat the 'clone_from' method as it
intends, which is as a class method. This creates a Repo object for us
as a result of the clone operation, which is what we intended anyway.
Change-Id: I244cb0189a26c5a5643e26c7b5791f703ad71023
---
M digium_git.py
1 file changed, 3 insertions(+), 4 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/repotools refs/changes/15/515/1
diff --git a/digium_git.py b/digium_git.py
index 2332ec4..871284a 100644
--- a/digium_git.py
+++ b/digium_git.py
@@ -139,12 +139,11 @@
raise ValueError("local_path {0} does not exist and "
"repo is None".format(local_path))
os.makedirs(local_path)
- self.repo = Repo()
if self.show_progress:
progress = GitProgressBar()
- self.repo = self.repo.clone_from(url=repo_url,
- to_path=local_path,
- progress=progress)
+ self.repo = Repo.clone_from(url=repo_url,
+ to_path=local_path,
+ progress=progress)
origin = self.repo.remotes.origin
if self.show_progress:
progress = GitProgressBar()
--
To view, visit https://gerrit.asterisk.org/515
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I244cb0189a26c5a5643e26c7b5791f703ad71023
Gerrit-PatchSet: 1
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
More information about the asterisk-code-review
mailing list