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 @@ -125,7 +125,7 @@ export function addCommmands(plugin: ObsidianGit) {
125
125
id : "force-pull" ,
126
126
name : "Force pull" ,
127
127
callback : ( ) =>
128
- plugin . promiseQueue . addTask ( ( ) => plugin . forcePullChangesFromRemote ( ) ) ,
128
+ plugin . promiseQueue . addTask ( ( ) => plugin . pullChangesFromRemote ( true ) ) ,
129
129
} ) ;
130
130
131
131
plugin . addCommand ( {
Original file line number Diff line number Diff line change @@ -430,7 +430,10 @@ export class IsomorphicGit extends GitManager {
430
430
ours : branchInfo . current ,
431
431
theirs : branchInfo . tracking ! ,
432
432
abortOnConflict : false ,
433
- strategyOption : force ? "theirs" : undefined ,
433
+ mergeDriver : force ? ( { contents } ) => {
434
+ const mergedText = contents [ 2 ] ;
435
+ return { cleanMerge : true , mergedText } ;
436
+ } : undefined ,
434
437
} )
435
438
) ;
436
439
if ( ! mergeRes . alreadyMerged ) {
Original file line number Diff line number Diff line change @@ -726,38 +726,10 @@ export default class ObsidianGit extends Plugin {
726
726
}
727
727
728
728
///Used for command
729
- async pullChangesFromRemote ( ) : Promise < void > {
729
+ async pullChangesFromRemote ( force : boolean = false ) : Promise < void > {
730
730
if ( ! ( await this . isAllInitialized ( ) ) ) return ;
731
731
732
- const filesUpdated = await this . pull ( false ) ;
733
- if ( filesUpdated === false ) {
734
- return ;
735
- }
736
- if ( ! filesUpdated ) {
737
- this . displayMessage ( "Pull: Everything is up-to-date" ) ;
738
- }
739
-
740
- if ( this . gitManager instanceof SimpleGit ) {
741
- const status = await this . updateCachedStatus ( ) ;
742
- if ( status . conflicted . length > 0 ) {
743
- this . displayError (
744
- `You have conflicts in ${ status . conflicted . length } ${
745
- status . conflicted . length == 1 ? "file" : "files"
746
- } `
747
- ) ;
748
- await this . handleConflict ( status . conflicted ) ;
749
- }
750
- }
751
-
752
- this . app . workspace . trigger ( "obsidian-git:refresh" ) ;
753
- this . setPluginState ( { gitAction : CurrentGitAction . idle } ) ;
754
- }
755
-
756
- ///Used for command
757
- async forcePullChangesFromRemote ( ) : Promise < void > {
758
- if ( ! ( await this . isAllInitialized ( ) ) ) return ;
759
-
760
- const filesUpdated = await this . pull ( true ) ;
732
+ const filesUpdated = await this . pull ( force ) ;
761
733
if ( filesUpdated === false ) {
762
734
return ;
763
735
}
You can’t perform that action at this time.
0 commit comments