diff --git a/README.md b/README.md index 9be3b896..55c2a873 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,12 @@ repo.remove('master', 'path/to/file', function(err) {}); Exploring files of a repository is easy too by accessing the top level tree object. +```js +repo.getCommit('master', sha, function(err, commit) {}); +``` + +Get information about a particular commit. + ```js repo.getTree('master', function(err, tree) {}); ``` @@ -304,6 +310,7 @@ Include these before github.js : ### 0.10.X Create and delete repositories +Repos - getCommit ### 0.9.X diff --git a/bower.json b/bower.json index 8a79d3a2..7404db39 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "github-api", "main": "github.js", - "version": "0.10.3", + "version": "0.10.5", "homepage": "https://github.com/michael/github", "authors": [ "Sergey Klimov (http://darvin.github.com/)" diff --git a/github.js b/github.js index d8cfd437..9f07d956 100644 --- a/github.js +++ b/github.js @@ -352,6 +352,16 @@ // For a given file path, get the corresponding sha (blob for files, tree for dirs) // ------- + this.getCommit = function(branch, sha, cb) { + _request("GET", repoPath + "/git/commits/"+sha, null, function(err, commit) { + if (err) return cb(err); + cb(null, commit); + }); + }; + + // For a given file path, get the corresponding sha (blob for files, tree for dirs) + // ------- + this.getSha = function(branch, path, cb) { if (!path || path === "") return that.getRef("heads/"+branch, cb); _request("GET", repoPath + "/contents/"+path, {ref: branch}, function(err, pathContent) { diff --git a/package.json b/package.json index e812f82c..e3a0149f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-api", - "version": "0.10.4", + "version": "0.10.5", "description": "A higher-level wrapper around the Github API.", "main": "github.js", "dependencies": { diff --git a/test/test.repo.js b/test/test.repo.js index 572fc749..fd95695d 100644 --- a/test/test.repo.js +++ b/test/test.repo.js @@ -49,6 +49,15 @@ test("Repo API", function(t) { }); }); + t.test('repo.getCommit', function(q) { + repo.getCommit('master', '20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, commit) { + q.error(err, 'get commit' + err); + q.ok(commit.message, 'v0.10.4', 'Returned commit message.'); + q.ok(commit.author.date, '2015-03-20T17:01:42Z', 'Got correct date.'); + q.end(); + }); + }); + clearTimeout(timeout); t.end(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy