Skip to content

Commit 82abfdf

Browse files
committed
Merge pull request #473 from nodegit/fix-commit-on-head
Fix `createCommitOnHead`
2 parents 57aeb86 + 0a8be46 commit 82abfdf

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

lib/repository.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,14 @@ Repository.prototype.createCommitOnHead = function(
484484
message,
485485
callback){
486486
var repo = this;
487+
var index;
487488

488-
return repo.openIndex().then(function(index) {
489-
index.read(true);
490-
491-
filesToAdd.forEach(function(filePath) {
492-
index.addByPath(filePath);
493-
});
494-
489+
return repo.openIndex().then(function(index_) {
490+
index = index_;
491+
index.read(1);
492+
return index.addAll();
493+
})
494+
.then(function() {
495495
index.write();
496496

497497
return index.writeTree();
@@ -643,8 +643,8 @@ Repository.prototype.fetchAll = function(
643643
/**
644644
* Merge a branch onto another branch
645645
*
646-
* @param {String|Ref} from
647646
* @param {String|Ref} to
647+
* @param {String|Ref} from
648648
* @return {Oid|Index} A commit id for a succesful merge or an index for a
649649
* merge with conflicts
650650
*/
@@ -807,8 +807,8 @@ Repository.prototype.checkoutBranch = function(branch, opts) {
807807

808808
var name = ref.name();
809809

810-
return repo.setHead(name,
811-
repo.defaultSignature(),
810+
return repo.setHead(name,
811+
repo.defaultSignature(),
812812
"Switch HEAD to " + name);
813813
})
814814
.then(function() {

0 commit comments

Comments
 (0)