@@ -700,7 +700,7 @@ export class SimpleGit extends GitManager {
700700 }
701701 }
702702
703- async push ( ) : Promise < number | undefined > {
703+ async push ( ) : Promise < number | undefined | null > {
704704 this . plugin . setPluginState ( { gitAction : CurrentGitAction . push } ) ;
705705 try {
706706 if ( this . plugin . settings . updateSubmodules ) {
@@ -714,7 +714,7 @@ export class SimpleGit extends GitManager {
714714 console . log ( res ) ;
715715 }
716716 const status = await this . git . status ( ) ;
717- const trackingBranch = status . tracking ! ;
717+ const trackingBranch = status . tracking ;
718718 const currentBranch = status . current ! ;
719719
720720 if ( ! trackingBranch && this . plugin . settings . updateSubmodules ) {
@@ -723,14 +723,16 @@ export class SimpleGit extends GitManager {
723723 ) ;
724724 return undefined ;
725725 }
726-
727- const remoteChangedFiles = (
728- await this . git . diffSummary ( [
729- currentBranch ,
730- trackingBranch ,
731- "--" ,
732- ] )
733- ) . changed ;
726+ let remoteChangedFiles : number | null = null ;
727+ if ( trackingBranch ) {
728+ remoteChangedFiles = (
729+ await this . git . diffSummary ( [
730+ currentBranch ,
731+ trackingBranch ,
732+ "--" ,
733+ ] )
734+ ) . changed ;
735+ }
734736
735737 await this . git . env ( { ...process . env , OBSIDIAN_GIT : 1 } ) . push ( ) ;
736738
@@ -938,9 +940,17 @@ export class SimpleGit extends GitManager {
938940 }
939941 }
940942
941- async getConfig ( path : string ) : Promise < string | undefined > {
942- const config = await this . git . listConfig ( "local" ) ;
943- const res = config . all [ path ] ;
943+ async getConfig (
944+ path : string ,
945+ scope : "local" | "global" | "all" = "local"
946+ ) : Promise < string | undefined > {
947+ let config : simple . ConfigListSummary ;
948+ if ( scope == "all" ) {
949+ config = await this . git . listConfig ( ) ;
950+ } else {
951+ config = await this . git . listConfig ( scope ) ;
952+ }
953+ const res = config . all [ path . toLowerCase ( ) ] ;
944954 if ( typeof res === "string" || res == undefined ) {
945955 return res ;
946956 } else {
0 commit comments