Fix stuff

This commit is contained in:
mitchellhamilton
2019-09-16 17:24:20 +10:00
parent 2a6d43cef5
commit 67d5b6e323
3 changed files with 6 additions and 5 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -90,8 +90,8 @@ test("getChangedPackages works", async () => {
name: "some-package", name: "some-package",
version: "1.0.0" version: "1.0.0"
}); });
await exec("git", ["add", "."]); await exec("git", ["add", "."], { cwd: dir });
await exec("git", ["commit", "-m", "'initial commit'"]); await exec("git", ["commit", "-m", "initial commit"], { cwd: dir });
let emptyWorkspaces = await getChangedPackages(dir); let emptyWorkspaces = await getChangedPackages(dir);
expect(emptyWorkspaces).toEqual([]); expect(emptyWorkspaces).toEqual([]);
let workspace = { let workspace = {
+3 -2
View File
@@ -28,11 +28,12 @@ export async function getChangedPackages(cwd: string) {
let workspacesByDirectory = new Map(workspaces.map(x => [x.dir, x])); let workspacesByDirectory = new Map(workspaces.map(x => [x.dir, x]));
let output = await execWithOutput("git", ["diff", "--only-names"], { cwd }); let output = await execWithOutput("git", ["diff", "--name-only"], { cwd });
let names = output.stdout.split("\n"); let names = output.stdout.split("\n");
let changedWorkspaces: Workspace[] = []; let changedWorkspaces: Workspace[] = [];
for (let name of names) { for (let name of names) {
let dirname = path.dirname(name); if (name === "") continue;
let dirname = path.resolve(cwd, path.dirname(name));
let workspace = workspacesByDirectory.get(dirname); let workspace = workspacesByDirectory.get(dirname);
if (workspace !== undefined) { if (workspace !== undefined) {
changedWorkspaces.push(workspace); changedWorkspaces.push(workspace);