Socket
Socket
Sign inDemoInstall

simple-git

Package Overview
Dependencies
Maintainers
1
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-git - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0

2

package.json
{
"name": "simple-git",
"description": "Simple GIT interface for node.js",
"version": "0.12.0",
"version": "0.13.0",
"author": "Steve King <steve@mydev.co>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -40,2 +40,4 @@ # Simple Git

`.log([from, to], handlerFn)` list commits between `from` and `to` tags or branch (if not specified will show all history)
`.checkout(checkoutWhat, handlerFn)` checks out the supplied tag, revision or branch

@@ -77,2 +79,4 @@

`.then(handlerFn)` calls a simple function in the current step
# Examples

@@ -96,3 +100,2 @@

// starting a new repo

@@ -115,2 +118,23 @@ require('simple-git')()

// update repo and print messages when there are changes, restart the app
require('simple-git')()
.then(function() {
console.log('Starting pull...');
})
.pull(function(err, update) {
if(update && update.summary.changes) {
require('child_process').exec('npm restart');
}
})
.then(function() {
console.log('pull done.');
});
// get a full commits list, and then only between 0.11.0 and 0.12.0 tags
require('simple-git')()
.log(function(err, log) {
console.log(log);
})
.log('0.11.0', '0.12.0', function(err, log) {
console.log(log);
})

@@ -356,2 +356,37 @@ (function() {

/**
* Call a simple function
* @param {Function} [then]
*/
Git.prototype.then = function(then) {
this._runCache.push(["echo ''", then]);
this._schedule();
return this;
};
/**
* Show commit logs.
*
* @param {String} [from]
* @param {String} [to]
* @param {Function} [then]
*/
Git.prototype.log = function(from, to, then) {
var command = "log --pretty=format:'%H;%ai;%s%d;%aN;%ae' ";
if (from && to) {
command += from + "..." + to;
}
if (typeof arguments[arguments.length - 1] === 'function') {
then = arguments[arguments.length - 1];
}
return this._run(command, function(err, data) {
then && then(err, !err && this._parseListLog(data));
});
};
Git.prototype._rm = function(files, options, then) {

@@ -481,2 +516,22 @@ return this._run(['rm %s "%s"', options, [].concat(files).join('" "')], function(err) {

Git.prototype._parseListLog = function(logs) {
var logList = logs.split('\n').map(function(item) {
var parts = item.split(';');
return {
hash: parts[0],
date: parts[1],
message: parts[2],
author_name: parts[3],
author_email: parts[4]
}
})
return {
latest: logList.length && logList[logList.length - 1],
total: logList.length,
all: logList
};
};
/**

@@ -483,0 +538,0 @@ * Schedules the supplied command to be run, the command should not include the name of the git binary and should

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc