<commit_before>define(function(require, exports, module) {
    main.consumes = [
        "Plugin", "scm", "proc", "c9", "ext"
    ];
    main.provides = ["scm.git"];
    return main;

    function main(options, imports, register) {
        var Plugin = imports.Plugin;
        var scm = imports.scm;
        var proc = imports.proc;
        var ext = imports.ext;
        var c9 = imports.c9;
        
        var basename = require("path").basename;
        var dirname = require("path").dirname;
        
        /***** Initialization *****/
        
        var plugin = new Plugin("Ajax.org", main.consumes);
        var emit = plugin.getEmitter();
        
        var workspaceDir = c9.workspaceDir;
        
        /***** Service *****/
        
        var remoteApi;
        function connect(callback){
            ext.loadRemotePlugin("scm.git", {
                code: require("text!./listen-service.js"),
                redefine: true
            }, function(err, remote) {
                if (err)
                    return callback && callback(err) || console.error(err);

                remoteApi = remote;

                remoteApi.connect(function(err, meta) {
                    if (err) 
                        return console.error(err); // this should never happen

                    var stream = meta.stream;
                    
                    stream.on("error", function(err) {
                        console.error(err);
                    });
                    
                    stream.on("data", function(payload) {
                        emit("status", { 
                            status: parseStatus(payload.status, true),
                        });
                    });

                    stream.on("close", function(){
                        connect(); // reconnect
                    });
                    
                    callback && callback();
                });
            });
        }
        
        /***** Methods *****/
        
        /**
         * Detect whether the path has a git repository 
         */
        function detect(path, callback){
            
        }
        
        function addAll(callback){
            git("add -u", callback);
        }
        
        function addFileToStaging(paths, callback){
            git(["add", "-f", "--ignore-errors", "--"].concat(paths), callback);
        }
        
        function unstageAll(callback){
            git("reset --mixed", callback);
        }
        
        function unstage(paths, callback){
            git(["reset", "--mixed", "--"].concat(paths), callback);
        }
        
        function fetch(options, callback){
            var args = ["fetch"];
            if (options.prune) args.push("--prune");
            if (options.branch) args.push(options.branch);
            git(args, callback);
        }
        
        function pull(options, callback){
            var args = ["pull"];
            if (options.prune) args.push("--prune");
            if (options.branch) args.push(options.branch);
            git(args, callback);
        }
        
        function push(options, callback){
            var args = ["push"];
            if (options.force) args.push("--force");
            if (options.branch) args.push(options.branch);
            git(args, callback);
        }
        
        function git(args, cb) {<commit_msg>Add syncing<commit_after>define(function(require, exports, module) {
    main.consumes = [
        "Plugin", "scm", "proc", "c9", "ext"
    ];
    main.provides = ["scm.git"];
    return main;

    function main(options, imports, register) {
        var Plugin = imports.Plugin;
        var scm = imports.scm;
        var proc = imports.proc;
        var ext = imports.ext;
        var c9 = imports.c9;
        
        var basename = require("path").basename;
        var dirname = require("path").dirname;
        
        /***** Initialization *****/
        
        var plugin = new Plugin("Ajax.org", main.consumes);
        var emit = plugin.getEmitter();
        
        var workspaceDir = c9.workspaceDir;
        
        /***** Service *****/
        
        var remoteApi;
        function connect(callback){
            ext.loadRemotePlugin("scm.git", {
                code: require("text!./listen-service.js"),
                redefine: true
            }, function(err, remote) {
                if (err)
                    return callback && callback(err) || console.error(err);

                remoteApi = remote;

                remoteApi.connect(function(err, meta) {
                    if (err) 
                        return console.error(err); // this should never happen

                    var stream = meta.stream;
                    
                    stream.on("error", function(err) {
                        console.error(err);
                    });
                    
                    stream.on("data", function(payload) {
                        emit("status", { 
                            status: parseStatus(payload.status, true),
                        });
                    });

                    stream.on("close", function(){
                        connect(); // reconnect
                    });
                    
                    callback && callback();
                });
            });
        }
        
        /***** Methods *****/
        
        /**
         * Detect whether the path has a git repository 
         */
        function detect(path, callback){
            
        }
        
        function addAll(callback){
            git("add -u", callback);
        }
        
        function addFileToStaging(paths, callback){
            git(["add", "-f", "--ignore-errors", "--"].concat(paths), callback);
        }
        
        function unstageAll(callback){
            git("reset --mixed", callback);
        }
        
        function unstage(paths, callback){
            git(["reset", "--mixed", "--"].concat(paths), callback);
        }
        
        function fetch(options, callback){
            if (typeof options == "function")
                callback = options, options = {};
            
            var args = ["fetch"];
            if (options.prune) args.push("--prune");
            if (options.branch) args.push(options.branch);
            git(args, callback);
        }
        
        function pull(options, callback){
            if (typeof options == "function")
                callback = options, options = {};
            
            var args = ["pull"];
            if (options.prune) args.push("--prune");
            if (options.branch) args.push(options.branch);
            git(args, callback);
        }
        
        function push(options, callback){
            if (typeof options == "function")
                callback = options, options = {};
            
            var args = ["push"];
            if (options.force) args.push("--force");
            if (options.branch) args.push(options.branch);
            git(args, callback);
        }
        
        function git(args, cb) {
{'fraction_non_alphanumeric': 0.1309774225213855, 'fraction_numerical': 0.00112186229140373, 'mean_word_length': 1.2135319677219119, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2777036', 'n_tokens_mistral': 1791, 'n_tokens_neox': 1709, 'n_words': 382}