From e2b8cef040cbb5ab894473de93b3ddbb63cf023b Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 5 Sep 2018 14:46:36 +0200
Subject: [PATCH] refactor: gitFs configuration option

Adds configuration option gitFs for git-based file operations.
---
 lib/config/definitions.js                 | 8 ++++++++
 lib/platform/github/index.js              | 5 +++--
 website/docs/self-hosted-configuration.md | 4 ++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/config/definitions.js b/lib/config/definitions.js
index 79c225e732..8a9dec8539 100644
--- a/lib/config/definitions.js
+++ b/lib/config/definitions.js
@@ -176,6 +176,14 @@ const options = [
     type: 'boolean',
   },
   // Bot administration
+  {
+    name: 'gitFs',
+    description: 'Use git for FS operations instead of API. GitHub only.',
+    stage: 'repository',
+    type: 'boolean',
+    admin: true,
+    default: false,
+  },
   {
     name: 'exposeEnv',
     description:
diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index aeb2e4488b..74141ed0f8 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -97,6 +97,7 @@ async function initRepo({
   mirrorMode,
   gitAuthor,
   gitPrivateKey,
+  gitFs,
 }) {
   logger.debug(`initRepo("${repository}")`);
   const opts = endpoints.find({ platform: 'github' }, { token, endpoint });
@@ -264,8 +265,8 @@ async function initRepo({
   }
 
   // istanbul ignore if
-  if (process.env.RENOVATE_GIT_FS) {
-    logger.debug('Using Git FS');
+  if (gitFs) {
+    logger.debug('Enabling Git FS');
     let { protocol, host } = URL.parse(opts.endpoint);
     if (host === 'api.github.com') {
       host = null;
diff --git a/website/docs/self-hosted-configuration.md b/website/docs/self-hosted-configuration.md
index d20b44a1f1..51bbc56ecd 100644
--- a/website/docs/self-hosted-configuration.md
+++ b/website/docs/self-hosted-configuration.md
@@ -33,6 +33,10 @@ You probably have no need for this option - it is an experimental setting for th
 
 RFC5322-compliant string if you wish to customise the git author for commits.
 
+## gitFs
+
+This setting is experimental, and works for GitHub repositories only. If enabled, Renovate will `git clone` repos and use `git` for file operations such as creating branches and committing files.
+
 ## gitPrivateKey
 
 ## logFile
-- 
GitLab