Skip to content

Commit

Permalink
shallow clones. Closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
macropin committed Dec 9, 2014
1 parent 2bac095 commit ab05236
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions voltgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def update_git_conf(self):
self.git_branch = self.git_cfg.get('git_branch', None)
self.git_tag = self.git_cfg.get('git_tag', None)



def write_envs(self):
env_file_path = self.local_config.get('env_file_path', None)
if env_file_path is not None:
Expand All @@ -99,13 +97,12 @@ def getExitCode(self):

def get_commands(self):
git_commands = list()
# Initialise clone
git_commands.append(['git', 'clone', self.url, '.'])
# Update to branch or tag
if self.tag is not None:
git_commands.append(['git', 'checkout', 'tags/%s' % self.tag])
git_commands.append(['git', 'clone', '--depth=1', '-b', '%s' % self.tag, self.url, '.']) # detached HEAD
elif self.branch is not None:
git_commands.append(['git', 'checkout', self.branch])
git_commands.append(['git', 'clone', '--depth=1', '-b', '%s' % self.branch, self.url, '.'])
else:
git_commands.append(['git', 'clone', '--depth=1', self.url, '.'])
# Update submodules
git_commands.append(['git', 'submodule', 'update', '--init'])
return git_commands
Expand All @@ -120,7 +117,7 @@ def run(self):
for cmd in self.get_commands():
return_code = self.call(cmd, cwd=self.destination)
if return_code != 0:
raise self.GitException('Git command failed')
raise self.GitException('Git command failed: %s' % ' '.join(cmd))


class MountManager(object):
Expand Down

0 comments on commit ab05236

Please sign in to comment.