Skip to content

Commit

Permalink
fix: set base path after clone
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Aug 15, 2022
1 parent 2bce927 commit 0327090
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,11 @@ export default class ObsidianGit extends Plugin {
dir = normalize(dir);
if (dir === "" || dir === ".") {
const modal = new GeneralModal(this.app, ["NO", "YES"], `Does your remote repo contain a ${app.vault.configDir} directory at the root?`, false, true);
const containsConflictDir = await modal.open() === "YES";
if (containsConflictDir) {
const containsConflictDir = await modal.open();
if (containsConflictDir === undefined) {
new Notice("Aborted clone");
return;
} else if (containsConflictDir === "YES") {
const modal = new GeneralModal(this.app, ["Abort clone", "DELETE ALL YOUR LOCAL CONFIG"], `To avoid conflicts, the local ${app.vault.configDir} directory needs to be deleted.`, false, true);
const shouldDelete = await modal.open() === "DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";
if (shouldDelete) {
Expand All @@ -459,6 +462,10 @@ export default class ObsidianGit extends Plugin {
}
new Notice(`Cloning new repo into "${dir}"`);
await this.gitManager.clone(url, dir);
if (dir) {
this.settings.basePath = dir;
this.saveSettings();
}
new Notice("Cloned new repo");
}
}
Expand Down

0 comments on commit 0327090

Please sign in to comment.