Skip to content

Commit

Permalink
fix: discard deleted files
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Sep 12, 2024
1 parent 73d2c29 commit 42bf536
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/gitManager/simpleGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,6 @@ export class SimpleGit extends GitManager {
}

async isTracked(path: string): Promise<boolean> {
const pathExists = await this.app.vault.adapter.exists(
this.getRelativeVaultPath(path)
);
if (!pathExists) {
return false;
}

const inSubmodule = await this.getSubmoduleOfFile(path);
const args = inSubmodule ? ["-C", inSubmodule.submodule] : [];
const relativePath = inSubmodule ? inSubmodule.relativeFilepath : path;
Expand Down Expand Up @@ -838,6 +831,14 @@ export class SimpleGit extends GitManager {
): Promise<{ submodule: string; relativeFilepath: string } | undefined> {
// Documentation: https://git-scm.com/docs/git-rev-parse

if (
!(await this.app.vault.adapter.exists(
path.dirname(repositoryRelativeFile)
))
) {
return undefined;
}

// git -C <dir-of-file> rev-parse --show-toplevel
// returns the submodules repository root as an absolute path
let submoduleRoot = await this.git.raw(
Expand Down

0 comments on commit 42bf536

Please sign in to comment.