| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | var git = require('../'), | |
| 2 | - path = require('path'); | ||
| 2 | + path = require('path'), | ||
| 3 | + sort = git.RevWalk.Sort; | ||
| 3 | 4 | ||
| 4 | 5 | // This code walks the history of the master branch and prints results | |
| 5 | 6 | // that look very similar to calling `git log` from the command line | |
@@ -11,7 +12,7 @@ git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) { | |||
| 11 | 12 | if (error) throw error; | |
| 12 | 13 | ||
| 13 | 14 | // History returns an event. | |
| 14 | - var history = branch.history(); | ||
| 15 | + var history = branch.history(sort.Time); | ||
| 15 | 16 | ||
| 16 | 17 | // History emits 'commit' event for each commit in the branch's history | |
| 17 | 18 | history.on('commit', function(commit) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,6 +66,8 @@ Commit.prototype.history = function() { | |||
| 66 | 66 | ||
| 67 | 67 | var oid = this.oid(); | |
| 68 | 68 | var revwalk = this.repo.createRevWalk(); | |
| 69 | + revwalk.sorting.apply(revwalk, arguments); | ||
| 70 | + | ||
| 69 | 71 | var commits = []; | |
| 70 | 72 | event.start = function() { | |
| 71 | 73 | revwalk.walk(oid, function commitRevWalk(error, commit) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ RevWalk.Sort = { | |||
| 17 | 17 | * Set the sort order for the revwalk. This function takes variable arguments | |
| 18 | 18 | * like `revwalk.sorting(git.RevWalk.Topological, git.RevWalk.Reverse).` | |
| 19 | 19 | * | |
| 20 | - * @param {Number} | ||
| 20 | + * @param {Number} sort | ||
| 21 | 21 | */ | |
| 22 | 22 | RevWalk.prototype.sorting = function() { | |
| 23 | 23 | var sort = 0; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments