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

fix($last-updated): use file author time instead of submodule commit time (0.x) #1639

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

DvdGiessen
Copy link
Contributor

@DvdGiessen DvdGiessen commented Jun 4, 2019

Summary
When using a Git submodule, the "last updated" time for all files within that submodule is incorrect.

This happens because the git log command, when operating from a working directory that is part of the parent repository, only operates on that parent repository. As a result, any query for the log for a specific file that is located in a submodule will return the log for the submodule entry itself.

So, for example, if we have a submodule /foo and a file /foo/bar.md, then even if bar.md was last updated many years ago, if we commited a update of the submodule five minutes ago that will cause Vuepress to show that bar.md was last updated 5 minutes ago, while in fact it hasn't.

This pull request resolves this bug by first changing the current working directory to the directory containing the file, so that if the file is part of a submodule, git log accesses the log of the submodule and retrieves the correct last updated time from that files history instead of only considering the submodule history of the parent repository. This of course also works the same for repositories without submodules so does not require any additional checks or workarounds.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE
  • Checked generated code in text editor

Other information:
I've also opened a pull request with the exact same changes for 1.x, see #1640.

@kefranabg kefranabg merged commit 8ed2bb6 into vuejs:0.x Sep 10, 2019
@vue-bot
Copy link

vue-bot commented Sep 10, 2019

Hey @DvdGiessen, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants