Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed solution to #746 : Allow disabling the git-commit-routine via hotkey-toggle #834

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Gewerd-Strauss
Copy link

Hello,

this is a proposed solution to the issue outlined in #746, allowing the user to temporarily suppress the plugin committing files via a hotkey-toggleable config-setting.
I remain that I have not found any issues arising from these changes on my end. I've tried to implement the solution comparable to existing code.

I am open for suggestions/review.

Thank you.
Sincerely,
~Gw

@Gewerd-Strauss Gewerd-Strauss force-pushed the feat/suggested-solution-to-#746 branch from 662cf27 to bd3b968 Compare January 6, 2025 10:00
@Gewerd-Strauss
Copy link
Author

I have since resolved the merge conflicts, but I am not entirely sure if they should be resolved this way. I'd leave this up to maintainers, and can revert these changes for manual review.

src/constants.ts Outdated
@@ -30,6 +30,7 @@ export const DEFAULT_SETTINGS: Omit<ObsidianGitSettings, "autoCommitMessage"> =
refreshSourceControl: Platform.isDesktopApp,
basePath: "",
differentIntervalCommitAndPush: false,
globalEnable: true,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename this to temporaryDisableAutomatics
So the toggle gets a new meaning as well. I think it's better to add a toggle to just disable all automatics all together. So push and pull as well.

src/main.ts Outdated
@@ -1216,11 +1218,7 @@ export default class ObsidianGit extends Plugin {
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.

\`\`\`diff
<<<<<<< HEAD
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be deleted, it may look like a merge conflict, but is meant to be this way.

@@ -64,6 +64,22 @@ export class ObsidianGitSettingsTab extends PluginSettingTab {

let setting: Setting;
if (gitReady) {
new Setting(containerEl).setName("Activation").setHeading();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a setting is needed for this. (I want to keep the amount of settings rather low) I guess a command is enough.

src/main.ts Outdated
@@ -785,6 +785,8 @@ export default class ObsidianGit extends Plugin {
amend?: boolean;
}): Promise<boolean> {
if (!(await this.isAllInitialized())) return false;
if (!(this.settings.globalEnable)) return false; // if globalEnable-checkbox is disabled, return without committing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should still be able to manually commit via Obsidian. Only the automatic commits should be disabled, don't they? So I would not add that check here, but reset the automatics and don't start them.

Copy link
Author

@Gewerd-Strauss Gewerd-Strauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I am not sure if this callback must be asynchronous or not, this is not my specialty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants