Skip to content

Commit

Permalink
fix: backup with reset sync method
Browse files Browse the repository at this point in the history
close #319
  • Loading branch information
Vinzent03 committed Sep 21, 2022
1 parent caaacd1 commit 41a00ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,16 @@ export default class ObsidianGit extends Plugin {
async createBackup(fromAutoBackup: boolean, requestCustomMessage = false): Promise<void> {
if (!await this.isAllInitialized()) return;

if (this.settings.syncMethod == "reset" && this.settings.pullBeforePush) {
await this.pull();
}

if (!(await this.commit(fromAutoBackup, requestCustomMessage))) return;

if (!this.settings.disablePush) {
// Prevent plugin to pull/push at every call of createBackup. Only if unpushed commits are present
if (await this.gitManager.canPush()) {
if (this.settings.pullBeforePush) {
if (this.settings.syncMethod != "reset" && this.settings.pullBeforePush) {
await this.pull();
}

Expand Down

0 comments on commit 41a00ff

Please sign in to comment.