classes/phing/tasks/ext/git/GitCloneTask.php
protected function doClone(VersionControl_Git $client)
    {
        $command = $client->getCommand('clone')
            ->setOption('q')
            ->setOption('bare', $this->isBare())
            ->setOption('single-branch', $this->isSingleBranch())
            ->setOption('depth', $this->hasDepth() ? $this->getDepth() : false)
            ->setOption('branch', $this->hasBranch() ? $this->getBranch() : false)
            ->addArgument($this->getRepository())
            ->addArgument($this->getTargetPath());

        if (is_dir($this->getTargetPath()) && version_compare('1.6.1.4', $client->getGitVersion(), '>=')) {
            $isEmptyDir = true;
            $entries = scandir($this->getTargetPath());
            foreach ($entries as $entry) {
                if ('.' !== $entry && '..' !== $entry) {
                    $isEmptyDir = false;

                    break;
                }
            }

            if ($isEmptyDir) {
                @rmdir($this->getTargetPath());
            }
        }

        $command->execute();
    }
protected function doClone(VersionControl_Git $client)
    {
        $command = $client->getCommand('clone')
            ->setOption('q')
            ->setOption('bare', $this->isBare())
            ->setOption('single-branch', $this->isSingleBranch())
            ->setOption('depth', $this->hasDepth() ? $this->getDepth() : false)
            ->setOption('branch', $this->hasBranch() ? $this->getBranch() : false)
            ->addArgument($this->getRepository())
            ->addArgument($this->getTargetPath());

        if (is_dir($this->getTargetPath()) && version_compare('1.6.1.4', $client->getGitVersion(), '>=')) {
            $isEmptyDir = true;
            $entries = scandir($this->getTargetPath());
            foreach ($entries as $entry) {
                if ('.' !== $entry && '..' !== $entry) {
                    $isEmptyDir = false;

                    break;
                }
            }

            if ($isEmptyDir) {
                @rmdir($this->getTargetPath());
            }
        }

        $command->execute();
    }
protected function doClone ( VersionControl_Git $ client ) { $ command = $ client -> getCommand ( 'clone' ) -> setOption ( 'q' ) -> setOption ( 'bare' , $ this -> isBare ( ) ) -> setOption ( 'single-branch' , $ this -> isSingleBranch ( ) ) -> setOption ( 'depth' , $ this -> hasDepth ( ) ? $ this -> getDepth ( ) : false ) -> setOption ( 'branch' , $ this -> hasBranch ( ) ? $ this -> getBranch ( ) : false ) -> addArgument ( $ this -> getRepository ( ) ) -> addArgument ( $ this -> getTargetPath ( ) ) ; if ( is_dir ( $ this -> getTargetPath ( ) ) && version_compare ( '1.6.1.4' , $ client -> getGitVersion ( ) , '>=' ) ) { $ isEmptyDir = true ; $ entries = scandir ( $ this -> getTargetPath ( ) ) ; foreach ( $ entries as $ entry ) { if ( '.' !== $ entry && '..' !== $ entry ) { $ isEmptyDir = false ; break ; } } if ( $ isEmptyDir ) { @ rmdir ( $ this -> getTargetPath ( ) ) ; } } $ command -> execute ( ) ; }
Create a new clone

@param VersionControl_Git $client

@throws VersionControl_Git_Exception
Create a new clone