Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Final commit, ready for tagging

  • Loading branch information...
commit c760bdce4baa372f42c868be4c992b2b35da2698 1 parent cb04773
@payload payload authored
Showing with 31 additions and 9 deletions.
  1. +29 −8 lib/git/commit.js
  2. +2 −1  lib/git/git.js
View
37 lib/git/commit.js
@@ -120,7 +120,11 @@ var actor = function(line) {
Commit.list_from_string = function(repo, text) {
// Split up the result
var lines = text.split("\n");
- var linesshift = function() { return lines.shift(); };
+ var linesshift = function() {
+ var l = lines.shift();
+ // console.log(l);
+ return l;
+ };
var commits = [];
// Parse all commit messages
while(lines.length > 0) {
@@ -152,17 +156,34 @@ Commit.list_from_string = function(repo, text) {
linesshift();
// Parse --raw lines
- var filechanges = []
+ var filechanges = {};
+ var fcre = /:(\d+) (\d+) ([a-z0-9]+) ([a-z0-9]+) (\S+)\s+(.+)/;
+ var numre = /(\S+)\s+(\S+)\s+(.+)/;
+ var line;
+ var matched;
while (lines.length > 0) {
- var re = /:(\d+) (\d+) ([a-z0-9]+) ([a-z0-9]+) (\S+)\s+(.+)/;
- var rawline = linesshift().match(re);
- if (!rawline) break;
- var filechange = {};
+ line = linesshift();
+ matched = line.match(fcre);
+ if (!matched) break;
+ var o = {};
var xs = ['a_mode', 'b_mode', 'a_blob', 'b_blob', 'what', 'path'];
for(var i = 0; i < xs.length; i++) {
- filechange[xs[i]] = rawline[i+1];
+ o[xs[i]] = matched[i+1];
}
- filechanges.push(filechange);
+ filechanges[o.path] = o;
+ }
+ while (line) {
+ matched = line.match(numre);
+ if (!matched) break;
+ var o = {};
+ var xs = ['plus', 'minus', 'path'];
+ for(var i = 0; i < xs.length; i++) {
+ o[xs[i]] = matched[i+1];
+ }
+ filechanges[o.path].plus = o.plus;
+ filechanges[o.path].minus = o.minus;
+ if (lines.length == 0) break;
+ line = linesshift();
}
// Move and point to next message
View
3  lib/git/git.js
@@ -228,6 +228,7 @@ Git.prototype.call_git = function(prefix, command, postfix, options, args, callb
var execute_git_call = function(call_string, options, callback) {
// Execute the git command
+ options.maxBuffer = 1024 * 1024;
exec(call_string, options,
function (error, stdout, stderr) {
if (error != null) {
@@ -605,7 +606,7 @@ Git.prototype.fs_write = function(file, content, callback) {
// Log function, returns the number of logs
Git.prototype.log = function(commit, path, options, callback) {
- args = ['--raw', '--no-abbrev'];
+ args = ['--raw', '--no-abbrev', '--numstat'];
if (path) {
args.push('--');
args.push(path);
Please sign in to comment.
Something went wrong with that request. Please try again.