FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`commit.getDiff` was diffing backwards · nodegit/nodegit@6c049ab · GitHub

Repository navigation

Commit 6c049ab

Browse files
authored andcommitted
commit.getDiff was diffing backwards
1 parent d9f49f8 commit 6c049ab

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎lib/commit.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Commit.prototype.getDiff = function(callback) {
173173
var diffs = parents.map(function(parent) {
174174
return parent.getTree().then(function(parentTree) {
175175
return commit.getTree().then(function(thisTree) {
176-
return parentTree.diff(thisTree);
176+
return thisTree.diff(parentTree);
177177
});
178178
});
179179
});

‎test/tests/diff.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ describe("Diff", function() {
5959
assert.equal(lines[1].origin(), Diff.LINE.CONTEXT);
6060
assert.equal(lines[2].origin(), Diff.LINE.CONTEXT);
6161

62-
var oldContent = "\n__Before submitting a pull request, please ensure " +
62+
var oldContent = "__Before submitting a pull request, please ensure " +
6363
"both unit tests and lint checks pass.__\n";
64-
assert.equal(lines[2].content(), oldContent);
64+
assert.equal(lines[3].content(), oldContent);
6565
assert.equal(lines[3].origin(), Diff.LINE.DELETION);
66-
assert.equal(lines[4].contentLen(), 90);
66+
assert.equal(lines[3].contentLen(), 90);
6767

6868
var newContent = "__Before submitting a pull request, please ensure " +
6969
"both that you've added unit tests to cover your shiny new code, " +
7070
"and that all unit tests and lint checks pass.__\n";
71-
assert.equal(lines[3].content(), newContent);
71+
assert.equal(lines[4].content(), newContent);
7272
assert.equal(lines[4].origin(), Diff.LINE.ADDITION);
73-
assert.equal(lines[3].contentLen(), 162);
73+
assert.equal(lines[4].contentLen(), 162);
7474
});
7575

7676
it("can diff the workdir with index", function() {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL