File tree Expand file tree Collapse file tree 3 files changed +7
-32
lines changed Expand file tree Collapse file tree 3 files changed +7
-32
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ export function addCommmands(plugin: ObsidianGit) {
126
126
id : "force-pull" ,
127
127
name : "Force pull" ,
128
128
callback : ( ) =>
129
- plugin . promiseQueue . addTask ( ( ) => plugin . forcePullChangesFromRemote ( ) ) ,
129
+ plugin . promiseQueue . addTask ( ( ) => plugin . pullChangesFromRemote ( true ) ) ,
130
130
} ) ;
131
131
132
132
plugin . addCommand ( {
Original file line number Diff line number Diff line change @@ -479,7 +479,10 @@ export class IsomorphicGit extends GitManager {
479
479
ours : branchInfo . current ,
480
480
theirs : branchInfo . tracking ! ,
481
481
abortOnConflict : false ,
482
- strategyOption : force ? "theirs" : undefined ,
482
+ mergeDriver : force ? ( { contents } ) => {
483
+ const mergedText = contents [ 2 ] ;
484
+ return { cleanMerge : true , mergedText } ;
485
+ } : undefined ,
483
486
} )
484
487
) ;
485
488
if ( ! mergeRes . alreadyMerged ) {
Original file line number Diff line number Diff line change @@ -748,38 +748,10 @@ export default class ObsidianGit extends Plugin {
748
748
}
749
749
750
750
///Used for command
751
- async pullChangesFromRemote ( ) : Promise < void > {
751
+ async pullChangesFromRemote ( force : boolean = false ) : Promise < void > {
752
752
if ( ! ( await this . isAllInitialized ( ) ) ) return ;
753
753
754
- const filesUpdated = await this . pull ( false ) ;
755
- if ( filesUpdated === false ) {
756
- return ;
757
- }
758
- if ( ! filesUpdated ) {
759
- this . displayMessage ( "Pull: Everything is up-to-date" ) ;
760
- }
761
-
762
- if ( this . gitManager instanceof SimpleGit ) {
763
- const status = await this . updateCachedStatus ( ) ;
764
- if ( status . conflicted . length > 0 ) {
765
- this . displayError (
766
- `You have conflicts in ${ status . conflicted . length } ${
767
- status . conflicted . length == 1 ? "file" : "files"
768
- } `
769
- ) ;
770
- await this . handleConflict ( status . conflicted ) ;
771
- }
772
- }
773
-
774
- this . app . workspace . trigger ( "obsidian-git:refresh" ) ;
775
- this . setPluginState ( { gitAction : CurrentGitAction . idle } ) ;
776
- }
777
-
778
- ///Used for command
779
- async forcePullChangesFromRemote ( ) : Promise < void > {
780
- if ( ! ( await this . isAllInitialized ( ) ) ) return ;
781
-
782
- const filesUpdated = await this . pull ( true ) ;
754
+ const filesUpdated = await this . pull ( force ) ;
783
755
if ( filesUpdated === false ) {
784
756
return ;
785
757
}
You can’t perform that action at this time.
0 commit comments