From 24c718dc72427a65b621fbee113faf37ebd20e79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ey=C3=BE=C3=B3r=20Magn=C3=BAsson?= <eysi09@gmail.com>
Date: Tue, 6 Aug 2019 08:35:00 +0200
Subject: [PATCH] fix(remote-sources): address PR comments (TBS)

---
 garden-service/src/util/fs.ts         | 2 +-
 garden-service/src/vcs/git.ts         | 3 ++-
 garden-service/src/watch.ts           | 4 ++--
 garden-service/test/unit/src/watch.ts | 6 +++---
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/garden-service/src/util/fs.ts b/garden-service/src/util/fs.ts
index 8a6c81dea5f..d8bada7124c 100644
--- a/garden-service/src/util/fs.ts
+++ b/garden-service/src/util/fs.ts
@@ -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-*"]
 
 /*
diff --git a/garden-service/src/vcs/git.ts b/garden-service/src/vcs/git.ts
index 51c0301df2e..d9dc88935db 100644
--- a/garden-service/src/vcs/git.ts
+++ b/garden-service/src/vcs/git.ts
@@ -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.
diff --git a/garden-service/src/watch.ts b/garden-service/src/watch.ts
index 2209a692df5..af15b55e584 100644
--- a/garden-service/src/watch.ts
+++ b/garden-service/src/watch.ts
@@ -22,7 +22,7 @@ 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
@@ -30,7 +30,7 @@ export function cleanUp() {
 }
 
 // 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>
 
diff --git a/garden-service/test/unit/src/watch.ts b/garden-service/test/unit/src/watch.ts
index a70e1c57317..5c3a13f8541 100644
--- a/garden-service/test/unit/src/watch.ts
+++ b/garden-service/test/unit/src/watch.ts
@@ -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"
 
@@ -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
@@ -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