Skip to content

Commit 11efffd

Browse files
committed
Fix nodegit#1339 Force backslashes with path.posix
Index's addByPath function does not accept backslashes. To ensure that forward slashes are used, path.posix is used to join paths together with a forward slash in a platform independent way. Signed-off-by: Remy Suen <remy.suen@gmail.com>
1 parent 113493a commit 11efffd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

examples/add-and-commit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
4646
})
4747
.then(function() {
4848
// this file is in a subdirectory and can use a relative path
49-
return index.addByPath(path.join(directoryName, fileName));
49+
return index.addByPath(path.posix.join(directoryName, fileName));
5050
})
5151
.then(function() {
5252
// this will write both files to the index

0 commit comments

Comments
 (0)