Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ export default class GitHubOctokitPlugin extends Plugin {
}

// Update main repo ignore patterns to exclude additional repo directories
const mainPatterns = this.getMainRepoIgnorePatterns();
this.syncService.configure(
this.getMainRepoIgnorePatterns(),
mainPatterns,
this.settings.subfolderPath,
this.settings.syncConfiguration
);
Expand Down Expand Up @@ -701,15 +702,23 @@ export default class GitHubOctokitPlugin extends Plugin {
}
);

if (vaultConfigs.length === 0) return;

const json = JSON.stringify(vaultConfigs, null, '\t');

try {
const existing = this.app.vault.getAbstractFileByPath(VAULT_REPOS_CONFIG_PATH);
if (existing instanceof TFile) {
await this.app.vault.modify(existing, json);
} else if (vaultConfigs.length > 0) {
// Only create the file if there are repos to persist
await this.app.vault.create(VAULT_REPOS_CONFIG_PATH, json);
} else {
// File may exist on disk but not yet be indexed by the vault
// (e.g. during early startup). Use the adapter as a fallback.
const onDisk = await this.app.vault.adapter.exists(VAULT_REPOS_CONFIG_PATH);
if (onDisk) {
await this.app.vault.adapter.write(VAULT_REPOS_CONFIG_PATH, json);
} else {
await this.app.vault.create(VAULT_REPOS_CONFIG_PATH, json);
}
}
} catch (error) {
console.error('Failed to save vault repo config:', error);
Expand Down
1 change: 0 additions & 1 deletion src/services/syncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export class SyncService {
} else {
// Main repo mode: scan all vault files
const files = this.vault.getFiles();

for (const file of files) {
// Skip ignored files
if (this.shouldIgnore(file.path)) {
Expand Down
Loading