Skip to content

Commit c0a8d97

Browse files
committed
Provide target repository to write the index to
The returned Index from Merge.commits() doesn't know where to write the index to because it is not backed by a repository. This prevents the example from running because the write() fails as it's only in-memory and has no notion of a target .git/index file. Skip the write() and just use writeTreeTo() immediately instead to write the index to the sample repository.
1 parent 0cff089 commit c0a8d97

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

examples/merge-cleanly.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ fse.remove(path.resolve(__dirname, repoDir))
116116
// the repository instead of just writing it.
117117
.then(function(index) {
118118
if (!index.hasConflicts()) {
119-
return index.write()
120-
.then(function() {
121-
return index.writeTreeTo(repository);
122-
});
119+
return index.writeTreeTo(repository);
123120
}
124121
})
125122

0 commit comments

Comments
 (0)