<commit_before>var exports = module.exports = {};
var shell = require('shelljs');
var CLONE_DIR = 'github-pages-to-deploy';

exports.run = function(gitHubCommitterEmail,
                       gitHubCommitterName,
                       gitHubAuthUsername,
                       gitHubAuthTokenOrPassword,
                       gitHubCloneUrl,
                       gitHubSubdirectory,
                       sourceDirToDeployContents) {
    console.log('running');

    var gitVersion = shell.exec('git --version', {silent:true}).stdout;

    console.log('gitVersion: ' + gitVersion);

    shell.exec('git config --global user.email "' + gitHubCommitterEmail + '"', {silent:true});
    shell.exec('git config --global user.name "' + gitHubCommitterName + '"', {silent:true});
    shell.exec('git config --global push.default simple', {silent:true});

    gitHubCloneUrl = gitHubCloneUrl.replace(/^https:\/\//,'https://' + gitHubAuthUsername + ':' + gitHubAuthTokenOrPassword + '@');

    //
    // CLONE
    //
    shell.exec('git clone --single-branch --branch gh-pages ' + gitHubCloneUrl + ' ' + CLONE_DIR, {silent:true});

    //
    // CREATE SUBDIR IF NECESSARY
    //
    var workspace = CLONE_DIR;
    if (gitHubSubdirectory !== undefined && gitHubSubdirectory !== null) {
        if (! shell.test('-d', CLONE_DIR + '/' + gitHubSubdirectory)) {
            shell.mkdir(CLONE_DIR + '/' + gitHubSubdirectory);
            workspace = CLONE_DIR + '/' + gitHubSubdirectory;
        }
    }

    //
    // COPY BUILD ARTIFACTS
    //
    shell.rm('-rf', workspace + '/*');
    shell.cp('-r', sourceDirToDeployContents + '/*', workspace + '/');

    shell.cd(workspace);
    shell.exec('git diff --exit-code', function(code, stdout, stderr) {
        if (code === 0) {
            shell.echo("NOTHING TO COMMIT");
        } else {
            shell.echo("CHANGES DETECTED. ADDING, COMMITTING, PUSHING.");
            shell.exec('git add . -A');
            shell.exec('git commit -m "automatic deploy by node-deploy-essentials script"');
            shell.exec('git push');
        }
    });
};<commit_msg>fix .git errro<commit_after>var exports = module.exports = {};
var shell = require('shelljs');
var CLONE_DIR = 'github-pages-to-deploy';

exports.run = function(gitHubCommitterEmail,
                       gitHubCommitterName,
                       gitHubAuthUsername,
                       gitHubAuthTokenOrPassword,
                       gitHubCloneUrl,
                       gitHubSubdirectory,
                       sourceDirToDeployContents) {
    console.log('running');

    var gitVersion = shell.exec('git --version', {silent:true}).stdout;

    console.log('gitVersion: ' + gitVersion);

    shell.exec('git config --global user.email "' + gitHubCommitterEmail + '"', {silent:true});
    shell.exec('git config --global user.name "' + gitHubCommitterName + '"', {silent:true});
    shell.exec('git config --global push.default simple', {silent:true});

    gitHubCloneUrl = gitHubCloneUrl.replace(/^https:\/\//,'https://' + gitHubAuthUsername + ':' + gitHubAuthTokenOrPassword + '@');

    //
    // TEST
    //
    if (shell.test('-d', '.git')) {
        shell.echo('PLEASE DELETE .git DIRECTORY. CANNOT CLONE INTO AND EXISTING REPOSITORY WORKSPACE! EXIT.')
        process.exit(2);
    }

        //
    // CLONE
    //
    shell.exec('git clone --single-branch --branch gh-pages ' + gitHubCloneUrl + ' ' + CLONE_DIR, {silent:true});

    //
    // CREATE SUBDIR IF NECESSARY
    //
    var workspace = CLONE_DIR;
    if (gitHubSubdirectory !== undefined && gitHubSubdirectory !== null) {
        if (! shell.test('-d', CLONE_DIR + '/' + gitHubSubdirectory)) {
            shell.mkdir(CLONE_DIR + '/' + gitHubSubdirectory);
            workspace = CLONE_DIR + '/' + gitHubSubdirectory;
        }
    }

    //
    // COPY BUILD ARTIFACTS
    //
    shell.rm('-rf', workspace + '/*');
    shell.cp('-r', sourceDirToDeployContents + '/*', workspace + '/');

    shell.cd(workspace);
    shell.exec('git diff --exit-code', function(code, stdout, stderr) {
        if (code === 0) {
            shell.echo("NOTHING TO COMMIT");
        } else {
            shell.echo("CHANGES DETECTED. ADDING, COMMITTING, PUSHING.");
            shell.exec('git add . -A');
            shell.exec('git commit -m "automatic deploy by node-deploy-essentials script"');
            shell.exec('git push');
        }
    });
};
{'fraction_non_alphanumeric': 0.1565884476534296, 'fraction_numerical': 0.0006768953068592057, 'mean_word_length': 2.2193173565722586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1053874', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1328, 'n_words': 254}