From 27e79cc9db2154bb0870cce154b8f4dc2487817a Mon Sep 17 00:00:00 2001 From: Neil Pullman Date: Mon, 19 Mar 2012 12:48:21 -0400 Subject: [PATCH] add ability to list all commits in a repo --- github.js | 10 ++++++++++ test/github-test.js | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/github.js b/github.js index 798cd097..d61f9da9 100644 --- a/github.js +++ b/github.js @@ -192,6 +192,16 @@ }); }; + // List all commits + // ------- + + this.list_commits = function (cb) { + _request("GET", repoPath + "/commits", null, function(err, res) { + if (err) return cb(err); + cb(null, res); + }); + }; + // Write file contents on a given path // ------- diff --git a/test/github-test.js b/test/github-test.js index 5a0821fa..430b0337 100644 --- a/test/github-test.js +++ b/test/github-test.js @@ -32,6 +32,15 @@ }); }); + test('should be capable of returning all commits', function () { + var github = new Github({username: USERNAME, password: PASSWORD, auth: "basic"}); + var repo = github.getRepo(REPO); + + repo.list_commits(function(err, res) { + //console.log(err, res) + }); + }) + test('should be capable of writing files', function() { var github = new Github({username: USERNAME, password: PASSWORD, auth: "basic"}); var repo = github.getRepo(REPO);