Skip to content

Commit

Permalink
fix(remote-sources): address PR comments (TBS)
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed Aug 6, 2019
1 parent a9d924a commit 24c718d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion garden-service/src/util/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { VcsHandler } from "../vcs/vcs"
const VALID_CONFIG_FILENAMES = ["garden.yml", "garden.yaml"]
const metadataFilename = "metadata.json"
export const defaultDotIgnoreFiles = [".gitignore", ".gardenignore"]
// FIXME: We should use `garden.gardenDirPath` instead of ".garden" since the dir name can be variable
// FIXME: We should use `garden.gardenDirPath` instead of ".garden" since the gardenDirPath property is configurable.
export const fixedExcludes = [".git", ".garden/**/*", "debug-info-*"]

/*
Expand Down
3 changes: 2 additions & 1 deletion garden-service/src/vcs/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export class GitHandler extends VcsHandler {
* We need to exclude .garden to avoid errors when path is the project root. This happens e.g. for modules
* whose config is colocated with the project config, and that don't specify include paths/patterns.
*/
// FIXME: We should use `garden.gardenDirPath` instead of ".garden" since the dir name can be variable
// FIXME: We should use `garden.gardenDirPath` instead of ".garden" since the gardenDirPath
// property is configurable.
lines = await git("ls-files", "-s", "--others", "--exclude=.garden", path)

// List ignored files from .gardenignore. We need to run ls-files twice to get both tracked and untracked files.
Expand Down
4 changes: 2 additions & 2 deletions garden-service/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import { isConfigFilename } from "./util/fs"
let watcher: FSWatcher | undefined

// Export so that we can clean up the global watcher instance when running tests
export function cleanUp() {
export function cleanUpGlobalWatcher() {
if (watcher) {
watcher.close()
watcher = undefined
}
}

// The process hangs after tests if we don't do this
registerCleanupFunction("stop watcher", cleanUp)
registerCleanupFunction("stop watcher", cleanUpGlobalWatcher)

export type ChangeHandler = (module: Module | null, configChanged: boolean) => Promise<void>

Expand Down
6 changes: 3 additions & 3 deletions garden-service/test/unit/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CacheContext, pathToCacheContext } from "../../../src/cache"
import { createFile, remove, pathExists } from "fs-extra"
import { getConfigFilePath } from "../../../src/util/fs"
import { LinkModuleCommand } from "../../../src/commands/link/module"
import { cleanUp } from "../../../src/watch"
import { cleanUpGlobalWatcher } from "../../../src/watch"
import { LinkSourceCommand } from "../../../src/commands/link/source"
import { sleep } from "../../../src/util/util"

Expand Down Expand Up @@ -222,7 +222,7 @@ describe("Watcher", () => {

before(async () => {
// The watcher instance is global so we clean up the previous one before proceeding
cleanUp()
cleanUpGlobalWatcher()
garden = await makeExtModuleSourcesGarden()

// Link some modules
Expand Down Expand Up @@ -291,7 +291,7 @@ describe("Watcher", () => {

before(async () => {
// The watcher instance is global so we clean up the previous one before proceeding
cleanUp()
cleanUpGlobalWatcher()
garden = await makeExtProjectSourcesGarden()

// Link some projects
Expand Down

0 comments on commit 24c718d

Please sign in to comment.