Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Two Characters of File Path Are Missing, Causing Errors (Show Git Diff view for active file) #29

Open
peppermint1231 opened this issue May 24, 2024 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@peppermint1231
Copy link

peppermint1231 commented May 24, 2024

Obsidian Git, version: 2.24.2
Version History Diff, version 2.2.0
Both are the latest versions.
The .git folder is located directly inside my vault.

  • I am using version control with Obsidian Git without any issues.
  • I am not using Sync.
  • The command "Show File Recovery diff view for active file" works fine.
  • The problem occurs only with the command "Show Git Diff view for active file."

Error

When running the command "Show Git Diff view for active file" on the file Myvault/123456.md, an error popup appears along with the following console error:
image

As you can see, the first two characters ("12") of the file path ("/123456.md") are missing, resulting in an error because "/3456.md" does not exist.

I conducted several experiments to investigate this issue.

1. Creating "/3456.md" and then running the command on "/123456.md":

image

  • The command executed but loaded "/3456.md".
  • However, clicking on the version causes another error because two more characters are missing from the filename, resulting in an error that "/56.md" cannot be found.
    image

2. Creating "xx123456.md" and then running the command:

  • Similarly, it loaded "123456.md", but clicking on the version caused an error because "/3456.md" could not be found.
    image
    image

This issue occurs with all files in the vault that are already committed.

For example, running the command on "/testfolder/123456.md" results in an error because the first two characters of the path ("te") are missing, leading to an error that "stfolder/123456.md" cannot be found.
image

How can I resolve this issue?

@peppermint1231
Copy link
Author

+ I tried disabling/enabling the version history diff plugin, deleting/reinstalling it, all to no avail.

@kometenstaub
Copy link
Owner

kometenstaub commented May 24, 2024

What are your Obsidian installer and app versions?
(Installer updates need to be made manually. If it’s not the latest, please update it and see if the issue still occurs.)

@peppermint1231
Copy link
Author

peppermint1231 commented May 24, 2024

What are your Obsidian installer and app versions?
(Installer updates need to be made manually. If it’s not the latest, please update it and see if the issue still occurs.)

If you're referring to the installer on the first install, the Obsidian installer is v1.5.12, and the current version is the same. latest. (OS: Windows 11)

@kometenstaub
Copy link
Owner

kometenstaub commented May 24, 2024

Has this issue always occurred or is this just happening now? (Have you been using the plugin for some time already or did you just try it out.)

@peppermint1231
Copy link
Author

Has this issue always occurred or is this just happening now? (Have you been using the plugin for some time already or did you just try it out.)

This issue has been happening since the first time I used the plugin (I installed it for the first time yesterday).

@kometenstaub
Copy link
Owner

I cannot reproduce the issue. I am on the early access version (same installer though), but that shouldn’t change anything.

I don’t know what would cause this.
I pass along the file path as I get it from Obsidian, and that part of the code has been the same for a long time.

@peppermint1231
Copy link
Author

I cannot reproduce the issue. I am on the early access version (same installer though), but that shouldn’t change anything.

I don’t know what would cause this. I pass along the file path as I get it from Obsidian, and that part of the code has been the same for a long time.

Thank you for reviewing this issue. I will also continue to investigate it further. Could you please tell me which file contains the code for retrieving the file path?

@kometenstaub
Copy link
Owner

new GitDiffView(this, this.app, file).open();

const gitVersions = await gitManager.log(this.file.path);

@kometenstaub kometenstaub added bug Something isn't working help wanted Extra attention is needed labels May 25, 2024
@kometenstaub
Copy link
Owner

If you figure out what the issue is, please let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants