From a13094544318b06902b54a24ea61691fe598a2fc Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 18 Aug 2023 04:20:15 +0000
Subject: [PATCH] fix when symlink targ is calculated and added npx quartz restore

---
 quartz/bootstrap-cli.mjs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs
index 0285551..990022e 100755
--- a/quartz/bootstrap-cli.mjs
+++ b/quartz/bootstrap-cli.mjs
@@ -267,6 +267,9 @@
     spawnSync("npm", ["i"], { stdio: "inherit" })
     console.log(chalk.green("Done!"))
   })
+  .command("restore", "Try to restore your content folder from the cache", async () => {
+    await popContentFolder()
+  })
   .command("sync", "Sync your Quartz to and from GitHub.", SyncArgv, async (argv) => {
     const contentFolder = path.join(cwd, argv.directory)
     console.log(chalk.bgGreen.black(`\n Quartz v${version} \n`))
@@ -275,13 +278,13 @@
     if (argv.commit) {
       const contentStat = await fs.promises.lstat(contentFolder)
       if (contentStat.isSymbolicLink()) {
+        const linkTarg = await fs.promises.readlink(contentFolder)
         console.log(chalk.yellow("Detected symlink, trying to dereference before committing"))
 
         // stash symlink file
         await stashContentFolder(contentFolder)
 
         // follow symlink and copy content
-        const linkTarg = await fs.promises.readlink(contentFolder)
         await fs.promises.cp(linkTarg, contentFolder, {
           force: true,
           recursive: true,

--
Gitblit v1.10.0