diff --git a/33222tt b/33222tt index 8b13789..7d4b09c 100644 --- a/33222tt +++ b/33222tt @@ -1 +1,2 @@ +"lalalalal" diff --git a/index.js b/index.js index 942ff08..ed4f715 100644 --- a/index.js +++ b/index.js @@ -37,15 +37,21 @@ module.exports = function(o_params){ } Object.assign(params, params_user); - git.pull(/*params.remote.repo, + git.pull(params.remote.repo, params.remote.branch, - params.pull_params, */ + params.pull_params, function(err, update){ if(!err){ - if(update && update.summary.changes){ + if(update && (update.summary.changes || update.summary.deletions || update.summary.insertions)){ if(o.allowNotice){ - console.log(new Date() + ' - cron-git: git pull done::' + update.summary.changes); + console.log(new Date() + ' - cron-git: git pull done::'); + console.log('---------------------------'); + console.log(update); + console.log('---------------------------'); } + if(callback !== undefined){ + callback(update); + } }else{ if(o.allowNotice){ console.log(new Date() + ' - cron-git: git pull done. Nothing changed!!'); @@ -55,11 +61,10 @@ module.exports = function(o_params){ if(o.allowNotice){ console.log(new Date() + ' - cron-git: git pull Failure.'); } - err_callback(); + if(err_callback !== undefined){ + err_callback(err); + } } - if(callback !== undefined){ - callback(); - } }); } @@ -91,8 +96,8 @@ module.exports = function(o_params){ /* sync action */ var sync = function(callback, err_callback, params_pull, params_push){ push(params_push); - pull(params_pull, function(){}, err_callback); - push(params_push, callback); + pull(params_pull, callback, err_callback); + push(params_push); } /* cron sync */ diff --git a/test.js b/test.js index 014d8bd..4c771f0 100644 --- a/test.js +++ b/test.js @@ -1,3 +1,4 @@ const crongit = require('./index.js')(); -crongit.schedule("10 * * * * *", ()=>console.log('test ok!!!\nuse Ctrl+C to exit!!'), ()=>console.log('pull err err err err!!!!')); +crongit.pull({}, ()=>{console.log('good')}, ()=>{console.log('bed')}); +//crongit.schedule("10 * * * * *", ()=>console.log('test ok!!!\nuse Ctrl+C to exit!!'), ()=>console.log('pull err err err err!!!!'));