protected function postCloneSetup(Builder $builder, $cloneTo)
    {
        $success = true;
        $commit = $this->getCommitId();

        $chdir = IS_WIN ? 'cd /d "%s"' : 'cd "%s"';

        if (!empty($commit) && $commit != 'Manual') {
            $cmd = $chdir . ' && git checkout %s --quiet';
            $success = $builder->executeCommand($cmd, $cloneTo, $commit);
        }

        // Always update the commit hash with the actual HEAD hash
        if ($builder->executeCommand($chdir . ' && git rev-parse HEAD', $cloneTo)) {
            $this->setCommitId(trim($builder->getLastOutput()));
        }

        return $success;
    }