Set jgit.config with trustFolderStat set to false for dual-master

Installations of gerrit over NFS (including EFS), should have
trustFolderStat set to false to avoid the in-memory cache of the
packfiles going out of sync with the files system.

Failing to do so might cause `Missing Unknown` errors raised by jgit.

Introduce a jgit.config file and set trustFolderStat to false
for the dual-master installation, which makes use of EFS.

Bug: Issue 13558
Change-Id: Ic427468f0ff4a52e683c4338813c8400992e791b
diff --git a/gerrit/etc/jgit.config.template b/gerrit/etc/jgit.config.template
new file mode 100644
index 0000000..630cd94
--- /dev/null
+++ b/gerrit/etc/jgit.config.template
@@ -0,0 +1,2 @@
+[core]
+  trustFolderStat = {{ TRUST_FOLDER_STAT }}
\ No newline at end of file
diff --git a/gerrit/setup_gerrit.py b/gerrit/setup_gerrit.py
index 1e63b32..81cec8d 100755
--- a/gerrit/setup_gerrit.py
+++ b/gerrit/setup_gerrit.py
@@ -186,6 +186,17 @@
                 MULTISITE_GLOBAL_PROJECTS=os.getenv('MULTISITE_GLOBAL_PROJECTS', '')
                 ))
 
+CONFIGURATION_FILE = "jgit.config"
+CONFIGURATION_TARGET = GERRIT_CONFIG_DIRECTORY + CONFIGURATION_FILE
+TEMPLATE_FILE = CONFIGURATION_FILE + ".template"
+
+print("*** "+ CONFIGURATION_TARGET)
+template = env.get_template(TEMPLATE_FILE)
+with open(CONFIGURATION_TARGET, 'w', encoding='utf-8') as f:
+    f.write(template.render(
+        TRUST_FOLDER_STAT="false" if setupHA else "true"
+    ))
+
 if (setupHA):
     print("Setting HA config in '" +
           GERRIT_CONFIG_DIRECTORY + "high-availability.config'")