From fe7c6aa9c3dce794afb28256e24da2e5ffc85a5a Mon Sep 17 00:00:00 2001 From: Weston McNamee Date: Wed, 29 Jun 2022 17:45:31 -0700 Subject: [PATCH] =?UTF-8?q?feat(deploy):=20=E2=9C=A8=20=20copy=20local=20g?= =?UTF-8?q?it=20config=20to=20tmp=20repo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this allows users to maintain any specific settings that aren't global --- packages/docusaurus/src/commands/deploy.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/docusaurus/src/commands/deploy.ts b/packages/docusaurus/src/commands/deploy.ts index 90d6f9cc5ee7..530d159b119b 100644 --- a/packages/docusaurus/src/commands/deploy.ts +++ b/packages/docusaurus/src/commands/deploy.ts @@ -183,6 +183,9 @@ You can also set the deploymentBranch property in docusaurus.config.js .`); // Save the commit hash that triggers publish-gh-pages before checking // out to deployment branch. const currentCommit = shellExecLog('git rev-parse HEAD').stdout.trim(); + const currentGitRootDir = shellExecLog( + 'git rev-parse --show-toplevel', + ).stdout.trim(); const runDeploy = async (outputDirectory: string) => { const fromPath = outputDirectory; @@ -213,6 +216,16 @@ You can also set the deploymentBranch property in docusaurus.config.js .`); logger.error`Copying build assets from path=${fromPath} to path=${toPath} failed.`; throw err; } + + const gitConfigFromPath = path.join(currentGitRootDir, `.git`, `config`); + const gitConfigToPath = path.join(toPath, `.git`, `config`); + try { + await fs.copy(gitConfigFromPath, gitConfigToPath); + } catch (err) { + logger.error`Copying git config from path=${gitConfigFromPath} to path=${gitConfigToPath} failed.`; + throw err; + } + shellExecLog('git add --all'); const commitMessage =