simple-git
Advanced tools
Comparing version 1.21.0 to 1.22.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.21.0", | ||
"version": "1.22.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -49,3 +49,4 @@ # Simple Git | ||
your repository. Then only this file will be considered. For any other set of options, supply `options` as an array of | ||
strings to be appended to the `git log` command. | ||
strings to be appended to the `git log` command. To use a custom splitter in the log format, set `options.splitter` to | ||
be the string the log should be split on. | ||
@@ -52,0 +53,0 @@ `.checkout(checkoutWhat, handlerFn)` checks out the supplied tag, revision or branch |
@@ -704,7 +704,9 @@ (function () { | ||
Git.prototype.log = function (options, then) { | ||
var command = ["log", "--pretty=format:'%H;%ai;%s%d;%aN;%ae'"]; | ||
var handler = Git.trailingFunctionArgument(arguments); | ||
var opt = (handler === then ? options : null) || {}; | ||
var splitter = opt.splitter || ';'; | ||
var command = ["log", "--pretty=format:'%H %ai %s%d %aN %ae'".replace(/\s+/g, splitter)]; | ||
if (Array.isArray(opt)) { | ||
@@ -735,3 +737,3 @@ command = command.concat(opt); | ||
return this._run(command, function (err, data) { | ||
handler && handler(err, !err && this._parseListLog(data)); | ||
handler && handler(err, !err && this._parseListLog(data, splitter)); | ||
}); | ||
@@ -838,5 +840,5 @@ }; | ||
Git.prototype._parseListLog = function (logs) { | ||
Git.prototype._parseListLog = function (logs, splitter) { | ||
var logList = logs.split('\n').map(function (item) { | ||
var parts = item.split(';'); | ||
var parts = item.split(splitter); | ||
@@ -843,0 +845,0 @@ return { |
@@ -215,2 +215,19 @@ | ||
'uses custom splitter': function (test) { | ||
git.log({splitter: "::"}, function (err, result) { | ||
test.equals(null, err, 'not an error'); | ||
test.same('ca931e641eb2929cf86093893e9a467e90bf4c9b', result.latest.hash, 'knows which is latest'); | ||
test.same(4, result.total, 'picked out all items'); | ||
test.done(); | ||
}); | ||
closeWith([ | ||
'ca931e641eb2929cf86093893e9a467e90bf4c9b::2016-01-04 18:54:56 +0100::Fix log.latest. (HEAD, stmbgr-master)::stmbgr::stmbgr@gmail.com', | ||
'8655cb1cf2a3d6b83f4e6f7ff50ee0569758e805::2016-01-03 16:02:22 +0000::Release 1.20.0 (origin/master, origin/HEAD, master)::Steve King::steve@mydev.co', | ||
'd4bdd0c823584519ddd70f8eceb8ff06c0d72324::2016-01-03 16:02:04 +0000::Support for any parameters to `git log` by supplying `options` as an array (tag: 1.20.0)::Steve King::ste', | ||
'207601debebc170830f2921acf2b6b27034c3b1f::2016-01-03 15:50:58 +0000::Release 1.19.0::Steve King::steve@mydev.co' | ||
].join('\n')) | ||
}, | ||
'with explicit from and to': function (test) { | ||
@@ -217,0 +234,0 @@ git.log('from', 'to', function (err, result) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61606
1428
180