1 | "use strict";
|
2 |
|
3 | const log = require("npmlog");
|
4 | const path = require("path");
|
5 | const slash = require("slash");
|
6 | const childProcess = require("@lerna/child-process");
|
7 |
|
8 | module.exports.gitAdd = gitAdd;
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function gitAdd(changedFiles, gitOpts, execOpts) {
|
16 |
|
17 | const files = gitOpts.granularPathspec
|
18 | ? changedFiles.map((file) => slash(path.relative(execOpts.cwd, path.resolve(execOpts.cwd, file))))
|
19 | : ".";
|
20 |
|
21 | log.silly("gitAdd", files);
|
22 |
|
23 | return childProcess.exec("git", ["add", "--", ...files], execOpts);
|
24 | }
|