Skip to content

Commit 37e17d7

Browse files
fix: add messages to SimpleGit's pull
1 parent f9c943d commit 37e17d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/gitManager/simpleGit.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ export class SimpleGit extends GitManager {
588588
@param {boolean} force - If true, merge strategy `--strategy-option=theirs` is used. This will prefer remote changes over local changes.
589589
*/
590590
async pull(force: boolean): Promise<FileStatusResult[] | undefined> {
591+
const progressNotice = this.plugin.displayMessage("Initializing pull");
591592
this.plugin.setPluginState({ gitAction: CurrentGitAction.pull });
592593
try {
593594
if (this.plugin.settings.updateSubmodules)
@@ -605,6 +606,9 @@ export class SimpleGit extends GitManager {
605606
this.plugin.log(
606607
"No tracking branch found. Ignoring pull of main repo and updating submodules only."
607608
);
609+
this.plugin.displayMessage(
610+
"No tracking branch found. Ignoring pull of main repo and updating submodules only."
611+
);
608612
return;
609613
}
610614

@@ -614,6 +618,7 @@ export class SimpleGit extends GitManager {
614618
]);
615619

616620
if (localCommit !== upstreamCommit) {
621+
let err = false;
617622
if (
618623
this.plugin.settings.syncMethod === "merge" ||
619624
this.plugin.settings.syncMethod === "rebase"
@@ -649,6 +654,7 @@ export class SimpleGit extends GitManager {
649654
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
650655
`Sync failed (${this.plugin.settings.syncMethod}): ${"message" in err ? err.message : err}`
651656
);
657+
err = true;
652658
}
653659
}
654660
this.app.workspace.trigger("obsidian-git:head-change");
@@ -662,6 +668,8 @@ export class SimpleGit extends GitManager {
662668
"--name-only",
663669
]);
664670

671+
if (!err) this.plugin.displayMessage("Finished pull");
672+
665673
return filesChanged
666674
.split(/\r\n|\r|\n/)
667675
.filter((value) => value.length > 0)

0 commit comments

Comments
 (0)