Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 7 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {});
```
Expand Down Expand Up @@ -304,6 +310,7 @@ Include these before github.js :
### 0.10.X

Create and delete repositories
Repos - getCommit

### 0.9.X

Expand Down
2 changes: 1 addition & 1 deletion 2 bower.json
Original file line number Diff line number Diff line change
@@ -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 <sergey.v.klimov@gmail.com> (http://darvin.github.com/)"
Expand Down
10 changes: 10 additions & 0 deletions 10 github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion 2 package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 9 additions & 0 deletions 9 test/test.repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.