I have a simple function to run git update-index.
exports.gitUpdateIndex = (path, pattern) => {
return new Promise((resolve, reject) => {
const error = [];
const opt = {
cwd: path
};
const process = spawn("git", ["update-index", "--chmod=+x", pattern], opt);
process.on("close", () => {
if (error.length > 0) {
reject(error);
}
resolve();
});
process.stderr.on("data", data => error.push(data.toString().trim()));
});
};
And I am trying to call it like -
await gitUpdateIndex(dirPath, "./*.sh");
But this is throwing an error like -
[
"Ignoring path *.sh\nfatal: git update-index: cannot chmod +x '*.sh'"
]
EDIT:
Seems like passing the absolute path to the function fixes it instead of an unix glob pattern.
await gitUpdateIndex(dirPath, "C:\\test\\hello.sh");