Skip to content

Commit

Permalink
Clone a single branch when initally cloning repository
Browse files Browse the repository at this point in the history
  • Loading branch information
FMCorz committed Mar 29, 2022
1 parent ebbd949 commit bbfab5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mdk/workplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def create(self, name=None, version='master', integration=False, useCacheAsRemot
extraDir = self.getPath(name, 'extra')
linkDir = os.path.join(self.www, name)
extraLinkDir = os.path.join(self.getMdkWebDir(), name)
branch = stableBranch(version)

if self.isMoodle(name):
raise CreateException('The Moodle instance %s already exists' % name)
Expand All @@ -147,7 +148,7 @@ def create(self, name=None, version='master', integration=False, useCacheAsRemot

# Clone the instances
logging.info('Cloning repository...')
process('%s clone %s %s' % (C.get('git'), repository, wwwDir))
process(f'{C.get("git")} clone --branch {branch} --single-branch {repository} {wwwDir}')

# Symbolic link
if os.path.islink(linkDir):
Expand Down Expand Up @@ -181,7 +182,6 @@ def create(self, name=None, version='master', integration=False, useCacheAsRemot

# Creating, fetch, pulling branches
repo.fetch(C.get('upstreamRemote'))
branch = stableBranch(version)
track = '%s/%s' % (C.get('upstreamRemote'), branch)
if not repo.hasBranch(branch) and not repo.createBranch(branch, track):
logging.error('Could not create branch %s tracking %s' % (branch, track))
Expand Down

0 comments on commit bbfab5d

Please sign in to comment.