Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed diff parsing

  • Loading branch information...
commit e72add51fd70586156b430faa280f5bc3bf4e032 1 parent 2b4f5ee
@payload payload authored
Showing with 7 additions and 20 deletions.
  1. +6 −19 lib/git/diff.js
  2. +1 −1  lib/git/repo.js
View
25 lib/git/diff.js
@@ -56,40 +56,27 @@ Diff.list_from_string = function(repo, text, callback) {
b_mode = null;
deleted_file = true;
}
-
- // Unpack index reference
- parts = lines.shift().match(/^index ([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+) ?(.+)?$/);
+ // Unpack index reference
+ parts = lines.shift().match(/^index ([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+) ?(.+)?$/);
a_blob = parts[1];
b_blob = parts[2];
b_mode = parts[3];
-
+
// Contains all the diff lines
var diff_lines = [];
// Fetch all the diff lines
- while(lines[0] && !lines[0].match(/^diff/)) {
+ while(lines.length > 0 && !lines[0].match(/^diff/)) {
diff_lines.push(lines.shift());
}
+
// Join the difflines
var diff = diff_lines.join("\n");
// Add the diff to the list
diffs.push(new Diff(repo, a_path, b_path, a_blob, b_blob, a_mode, b_mode, new_file, deleted_file, diff));
}
}
-
+
// Return the list of diffs
callback(null, diffs);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
View
2  lib/git/repo.js
@@ -187,7 +187,7 @@ Repo.prototype.fork_bare = function(path, options, callback) {
// paths: optional list of file paths on which to restrict the diff
Repo.prototype.diff = function(a, b, paths, callback) {
var self = this;
- var args = Array.prototype.slice.call(arguments, 2);
+ var args = Array.prototype.slice.call(arguments, 0); // XXX doesnt seem correct but it works for me
callback = args.pop();
b = args.length ? args.shift() : null;
paths = args.length ? args.shift() : [];
Please sign in to comment.
Something went wrong with that request. Please try again.