@@ -667,7 +667,7 @@ export default class ObsidianGit extends Plugin {
667
667
) {
668
668
await this . push ( ) ;
669
669
} else {
670
- this . displayMessage ( "No changes to push" ) ;
670
+ this . displayMessage ( "No commits to push" ) ;
671
671
}
672
672
}
673
673
this . setPluginState ( { gitAction : CurrentGitAction . idle } ) ;
@@ -717,28 +717,33 @@ export default class ObsidianGit extends Plugin {
717
717
return false ;
718
718
}
719
719
changedFiles = [ ...status . changed , ...status . staged ] ;
720
- } else if ( fromAuto && hadConflict ) {
721
- this . displayError (
722
- `Did not commit, because you have conflicts. Please resolve them and commit per command.`
723
- ) ;
724
- return false ;
725
- } else if ( hadConflict ) {
726
- await this . mayDeleteConflictFile ( ) ;
727
- status = await this . updateCachedStatus ( ) ;
728
- changedFiles = [ ...status . changed , ...status . staged ] ;
729
720
} else {
730
- if ( onlyStaged ) {
731
- changedFiles = await (
732
- this . gitManager as IsomorphicGit
733
- ) . getStagedFiles ( ) ;
721
+ // isomorphic-git section
722
+
723
+ if ( fromAuto && hadConflict ) {
724
+ // isomorphic-git doesn't have a way to detect current
725
+ // conflicts, they are only detected on commit
726
+ //
727
+ // Conflicts should only be resolved by manually committing.
728
+ this . displayError (
729
+ `Did not commit, because you have conflicts. Please resolve them and commit per command.`
730
+ ) ;
731
+ return false ;
732
+ } else if ( hadConflict ) {
733
+ await this . mayDeleteConflictFile ( ) ;
734
+ status = await this . updateCachedStatus ( ) ;
735
+ changedFiles = [ ...status . changed , ...status . staged ] ;
734
736
} else {
735
- unstagedFiles = await (
736
- this . gitManager as IsomorphicGit
737
- ) . getUnstagedFiles ( ) ;
738
- changedFiles = unstagedFiles . map ( ( { filepath } ) => ( {
739
- vault_path :
740
- this . gitManager . getRelativeVaultPath ( filepath ) ,
741
- } ) ) ;
737
+ const gitManager = this . gitManager as IsomorphicGit ;
738
+ if ( onlyStaged ) {
739
+ changedFiles = await gitManager . getStagedFiles ( ) ;
740
+ } else {
741
+ unstagedFiles = await gitManager . getUnstagedFiles ( ) ;
742
+ changedFiles = unstagedFiles . map ( ( { filepath } ) => ( {
743
+ vault_path :
744
+ this . gitManager . getRelativeVaultPath ( filepath ) ,
745
+ } ) ) ;
746
+ }
742
747
}
743
748
}
744
749
@@ -864,7 +869,7 @@ export default class ObsidianGit extends Plugin {
864
869
} to remote`
865
870
) ;
866
871
} else {
867
- this . displayMessage ( `No changes to push` ) ;
872
+ this . displayMessage ( `No commits to push` ) ;
868
873
}
869
874
}
870
875
this . setPluginState ( { offlineMode : false } ) ;
@@ -1250,8 +1255,10 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For
1250
1255
} else {
1251
1256
this . log ( "Encountered network error, but already in offline mode" ) ;
1252
1257
}
1253
- this . setPluginState ( { offlineMode : true } ) ;
1254
- this . setPluginState ( { gitAction : CurrentGitAction . idle } ) ;
1258
+ this . setPluginState ( {
1259
+ gitAction : CurrentGitAction . idle ,
1260
+ offlineMode : true ,
1261
+ } ) ;
1255
1262
}
1256
1263
1257
1264
// region: displaying / formatting messages
0 commit comments