Skip to content

Commit

Permalink
fix: too many changes to display
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Aug 24, 2022
1 parent 1c38b91 commit c4bf4eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ export default class ObsidianGit extends Plugin {

const status = await this.gitManager.status();
this.setState(PluginState.idle);
if (status.changed.length + status.staged.length > 500) {
this.displayError("Too many changes to display");
return;
}

new ChangedFilesModal(this, status.changed).open();
}
Expand Down
32 changes: 21 additions & 11 deletions src/ui/sidebar/gitView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,24 @@
};
}
if (status) {
changeHierarchy = {
title: "",
children: plugin.gitManager.getTreeStructure(status.changed),
};
stagedHierarchy = {
title: "",
children: plugin.gitManager.getTreeStructure(status.staged),
};
if (status.changed.length + status.staged.length > 500) {
status = undefined;
if (!plugin.loading) {
plugin.displayError("Too many changes to display");
}
} else {
changeHierarchy = {
title: "",
children: plugin.gitManager.getTreeStructure(status.changed),
};
stagedHierarchy = {
title: "",
children: plugin.gitManager.getTreeStructure(status.staged),
};
}
} else {
changeHierarchy = undefined;
stagedHierarchy = undefined;
}
loading = plugin.loading;
}
Expand All @@ -102,14 +112,14 @@
function stageAll() {
loading = true;
plugin.gitManager.stageAll({status: status}).finally(triggerRefresh);
plugin.gitManager.stageAll({ status: status }).finally(triggerRefresh);
}
function unstageAll() {
loading = true;
plugin.gitManager.unstageAll({status:status}).finally(triggerRefresh);
plugin.gitManager.unstageAll({ status: status }).finally(triggerRefresh);
}
function push() {
loading = true;
Expand Down

0 comments on commit c4bf4eb

Please sign in to comment.