Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

nodegit-kit

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodegit-kit - npm Package Compare versions

Comparing version
0.4.2
to
0.5.0
+17
-7
lib/diff.js

@@ -87,3 +87,3 @@ 'use strict';

function diffIndex(repo, commit){
var diffIndex = function(repo, commit){
return commit.getTree()

@@ -103,5 +103,5 @@ .then(function(tree){

});
}
};
function diffCommit(commit){
var diffCommit = function(commit){
return commit.getDiff()

@@ -112,5 +112,5 @@ .then(function(diff){

});
}
};
function diffTree(commit, tree){
var diffTree = function(commit, tree){
return commit.getTree()

@@ -123,3 +123,3 @@ .then(function(current){

});
}
};

@@ -135,3 +135,13 @@ // git.diff(repo)

var diffWorkdir = function(repo, commit){
return commit.getTree()
.then(function(tree){
return Git.Diff.treeToWorkdir(repo, tree);
})
.then(function(diff){
return diff.patches();
});
};
module.exports = function(repo, o, o2){

@@ -153,3 +163,3 @@

if (!!o){
return diffCommit(from);
return diffWorkdir(repo, from);
}

@@ -156,0 +166,0 @@

@@ -7,34 +7,37 @@ 'use strict';

module.exports = function(repo, o){
o = o || {};
if (o == null){
module.exports = function(repo, option){
if (option == null){
return repo.getBranchCommit('master');
}
if (o instanceof Git.Commit){
return Promise.resolve(o);
option = option || {};
if (option instanceof Git.Commit){
return Promise.resolve(option);
}
if (o instanceof Git.Oid){
return repo.getCommit(o);
if (option instanceof Git.Oid){
return repo.getCommit(option);
}
return Promise.resolve({
'branch': o.branch || 'master',
'commit': o.commit || o
'branch': option.branch || 'master',
'commit': option.commit || option || 'HEAD'
})
.then(function(option){
if (typeof option.commit != 'string'){
return repo.getBranchCommit(option.branch);
.then(function(o){
if (typeof o.commit != 'string'){
return repo.getBranchCommit(o.branch);
}
if (option.commit.length == 40){
return repo.getCommit(o);
if (o.commit.length == 40){
return repo.getCommit(o.commit);
}
return Git.AnnotatedCommit.fromRevspec(repo, option.commit)
.then(function(annotatedCommit){
return annotatedCommit.id();
})
.then(function(id){
return repo.getCommit(id);
return repo.getCommit(o.commit)
.catch(function(){
return Git.AnnotatedCommit.fromRevspec(repo, o.commit)
.then(function(annotatedCommit){
debug('annotated commit %s', o.commit);
return annotatedCommit.id();
})
.then(function(id){
return repo.getCommit(id);
});
});
});
};
{
"name": "nodegit-kit",
"description": "Promises for git commands like init, add, commit, status, diff",
"version": "0.4.2",
"version": "0.5.0",
"main": "lib/main.js",

@@ -28,4 +28,4 @@ "repository": {

"debug": "^2.2.0",
"fildes": "^1.0.1",
"nodegit": "^0.6.0"
"fildes": "^1.0.3",
"nodegit": "^0.6.2"
},

@@ -32,0 +32,0 @@ "license": "MIT",

@@ -60,3 +60,3 @@ NodeGit-Kit

- [log](#log-repo-options)
- [diff](#diff-repo)
- [diff](#diff-repo-commit-commit)
- [config](#config)

@@ -63,0 +63,0 @@ - [init](#init-path-options)