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

[Bug] plugin-md-enhance 文件导入功能,获取导入文件的git信息时失败 #3972

Closed
6 of 8 tasks
pengzhanbo opened this issue Mar 15, 2024 · 3 comments
Closed
6 of 8 tasks
Assignees
Labels
bug Something isn't working

Comments

@pengzhanbo
Copy link
Contributor

Checklist

  • I am using LTS version of Node.js.
  • I am using the latest v2 version of VuePress and VuePress official plugins.
  • I am using the latest v2 version of vuepress-theme-hope and all plugins in this repo.
  • I followed the docs and I double checked my configuration.
  • I have searched FAQ and I did not find the answer.

Package name

vuepress-plugin-md-enhance

Which operating system are you using?

  • macOS
  • Windows
  • Linux

Describe the bug

diff R377-R384

文件导入功能,在为 导入的文件添加 git信息 后,未能找到文件。

目录结构如下:

.root
   | docs
   |   |  contributing.md
   | CONTRIBUTING.md

contributing.md

<!-- @include: ../CONTRIBUTING.md{2-} -->

Log:

Error: Command failed with exit code 128: git --no-pager log --format=%at contributing.md ../../CONTRIBUTING.md
[1] fatal: ../../CONTRIBUTING.md:工作区中无此路径。

文件导入功能在 rc.25 版本中可正常导入。

Additional context

No response

@pengzhanbo pengzhanbo added the bug Something isn't working label Mar 15, 2024
@Mister-Hope
Copy link
Member

Mister-Hope commented Mar 15, 2024

我认为这个文件应该在你的vuepress项目目录之外。git插件是设计追踪项目内的文件。

这里可以额外加一个过滤,不过本质上如果你想要的这个功能生效,你是不应该引项目外的文件的

@pengzhanbo
Copy link
Contributor Author

但是它们都是位于同一个 git 仓库之内,并未脱离整个项目,应该是可以被追踪的。虽然我并不关心导入的文件的最后更新时间。

@pengzhanbo
Copy link
Contributor Author

对问题进行排查,发现实际上是由于命令生成错了:

- git --no-pager log --format=%at contributing.md ../../CONTRIBUTING.md
+ git --no-pager log --format=%at contributing.md ../CONTRIBUTING.md

即生成了错误的 文件相对路径。

docs 目录下执行 git --no-pager log --format=%at contributing.md ../CONTRIBUTING.md 是可以正确获取到文件的最后更新时间的。

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

No branches or pull requests

2 participants