Commit e68932aa authored by NGPixel's avatar NGPixel

feat: purge local repo action for git module

parent b1c7edac
...@@ -109,3 +109,6 @@ actions: ...@@ -109,3 +109,6 @@ actions:
- handler: importAll - handler: importAll
label: Import Everything label: Import Everything
hint: Will import all content currently in the local Git repository, regardless of the latest commit state. Useful for importing content from the remote repository created before git was enabled. hint: Will import all content currently in the local Git repository, regardless of the latest commit state. Useful for importing content from the remote repository created before git was enabled.
- handler: purge
label: Purge Local Repository
hint: If you have unrelated merge histories, clearing the local repository can resolve this issue. This will not affect the remote repository or perform any commit.
...@@ -78,8 +78,8 @@ module.exports = { ...@@ -78,8 +78,8 @@ module.exports = {
} }
} }
if (this.config.sshPort <= 0) { if (this.config.sshPort <= 0) {
this.config.sshPort = 22 this.config.sshPort = 22
} }
await this.git.addConfig('core.sshCommand', `ssh -i "${this.config.sshPrivateKeyPath}" -o StrictHostKeyChecking=no -p ${this.config.sshPort}`) await this.git.addConfig('core.sshCommand', `ssh -i "${this.config.sshPrivateKeyPath}" -o StrictHostKeyChecking=no -p ${this.config.sshPort}`)
WIKI.logger.info('(STORAGE/GIT) Adding origin remote via SSH...') WIKI.logger.info('(STORAGE/GIT) Adding origin remote via SSH...')
await this.git.addRemote('origin', this.config.repoUrl) await this.git.addRemote('origin', this.config.repoUrl)
...@@ -443,5 +443,11 @@ module.exports = { ...@@ -443,5 +443,11 @@ module.exports = {
await this.git.commit(`docs: add all untracked content`) await this.git.commit(`docs: add all untracked content`)
WIKI.logger.info('(STORAGE/GIT) All content is now tracked.') WIKI.logger.info('(STORAGE/GIT) All content is now tracked.')
},
async purge() {
WIKI.logger.info(`(STORAGE/GIT) Purging local repository...`)
await fs.emptyDir(this.repoPath)
WIKI.logger.info('(STORAGE/GIT) Local repository is now empty. Reinitializing...')
await this.init()
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment