From 5be7bd69ef05fe59a667eab379375d6367ae9011 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 26 Nov 2018 21:55:02 +1100 Subject: [PATCH] Only log error if enabled --- lib/models/workdir-cache.js | 12 +++++++----- package.json | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/models/workdir-cache.js b/lib/models/workdir-cache.js index 08bbc87385..dcb946dfb0 100644 --- a/lib/models/workdir-cache.js +++ b/lib/models/workdir-cache.js @@ -50,11 +50,13 @@ export default class WorkdirCache { const gitDir = await CompositeGitStrategy.create(startDir).exec(['rev-parse', '--absolute-git-dir']); return this.revParse(path.resolve(gitDir, '..')); } catch (e) { - // eslint-disable-next-line no-console - console.error( - `Unable to locate git workspace root for ${startPath}. Expected if ${startPath} is not in a git repository.`, - e, - ); + if (atom.config.get('github.reportCannotLocateWorkspaceError')) { + // eslint-disable-next-line no-console + console.error( + `Unable to locate git workspace root for ${startPath}. Expected if ${startPath} is not in a git repository.`, + e, + ); + } return null; } } diff --git a/package.json b/package.json index 628a56bc5d..94ea85116d 100644 --- a/package.json +++ b/package.json @@ -189,6 +189,11 @@ "type": "string", "default": "", "description": "Comma-separated list of email addresses to exclude from the co-author selection list" + }, + "reportCannotLocateWorkspaceError": { + "type": "boolean", + "default": "false", + "description": "Log an error to the console if a git repository cannot be located for the opened file " } }, "deserializers": {