11import { App , Notice , Platform , PluginSettingTab , Setting } from "obsidian" ;
22import type AutoGitPlugin from "./main" ;
33import { t } from "./i18n" ;
4- import { isGitRepo , initRepo , getRemoteUrl , setRemoteUrl , hasConflicts , markConflictsResolved , detectRepoState , RepoState , connectToRemote , initAndPush , setUpstream } from "./git" ;
4+ import { isGitRepo , initRepo , getRemoteUrl , setRemoteUrl , hasConflicts , markConflictsResolved , detectRepoState , RepoState , connectToRemote , initAndPush , setUpstream , setGitDebug } from "./git" ;
55
66export interface AutoGitSettings {
77 autoCommit : boolean ;
@@ -16,6 +16,7 @@ export interface AutoGitSettings {
1616 showStatusBadge : boolean ;
1717 showRibbonButton : boolean ;
1818 badgeRefreshInterval : number ; // 0 = disabled, otherwise seconds
19+ debugLog : boolean ;
1920}
2021
2122export const DEFAULT_SETTINGS : AutoGitSettings = {
@@ -31,6 +32,7 @@ export const DEFAULT_SETTINGS: AutoGitSettings = {
3132 showStatusBadge : true ,
3233 showRibbonButton : true ,
3334 badgeRefreshInterval : 0 , // 0 = disabled (event-driven only), otherwise seconds
35+ debugLog : false ,
3436} ;
3537
3638export class AutoGitSettingTab extends PluginSettingTab {
@@ -216,6 +218,17 @@ export class AutoGitSettingTab extends PluginSettingTab {
216218 await this . plugin . saveSettings ( ) ;
217219 } )
218220 ) ;
221+
222+ new Setting ( containerEl )
223+ . setName ( i18n . debugLogName )
224+ . setDesc ( i18n . debugLogDesc )
225+ . addToggle ( ( toggle ) =>
226+ toggle . setValue ( this . plugin . settings . debugLog ) . onChange ( async ( value ) => {
227+ this . plugin . settings . debugLog = value ;
228+ setGitDebug ( value ) ;
229+ await this . plugin . saveSettings ( ) ;
230+ } )
231+ ) ;
219232 }
220233
221234 private async displaySetupSection ( container : HTMLElement ) : Promise < void > {
0 commit comments