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

if a file has no git logs, use the last modified timestamp instead of the current #111

Open
eshaben opened this issue Mar 23, 2023 · 4 comments

Comments

@eshaben
Copy link

eshaben commented Mar 23, 2023

I'm experiencing an interesting issue where I get the following error for a few of the pages of the documentation site I am working on:

WARNING  -  [git-revision-date-localized-plugin] '<file path>' has no git logs, using current timestamp

Then when I view the pages it shows the last modified date correctly, but for the created date, it shows the current date. For example:

Last update:
March 6, 2023
Created:
March 23, 2023

I think if there are no logs found for the created date, it should default to the last update date if available.

It'd also be nice to know the underlying reason why it can't find the git logs for when these pages were created, if you have any ideas?

@timvink
Copy link
Owner

timvink commented Apr 12, 2023

Hi @eshaben ,

Thanks for reporting. Definitely something wrong here.

The difference between last modified and creation date in commands is only very small:

commit_timestamp = git.log(
realpath, date="unix", format="%at", diff_filter="A", no_show_signature=True, follow=True
)

commit_timestamp = git.log(
realpath, date="unix", format="%at", n=1, no_show_signature=True
)

That translates to:

git log --date=unix --format=%at -n=1 --diff-filter=A <filepath>
git log --date=unix --format=%at -n=1 <filepath>

Could you have a look for one of the pages and run those two commands? I wonder if the first command return something empty or an error..

You're probably not the only one, so keen to figure this one out :)

@eshaben
Copy link
Author

eshaben commented Apr 12, 2023

Thanks for the response! 🙂

Sure. This is one of the pages we're getting this error on: https://github.com/PureStake/moonbeam-docs/blob/master/builders/build/eth-api/dev-env/scaffold-eth.md

When I run git log --date=unix --format=%at -n 1 --diff-filter=A -- builders/build/eth-api/dev-env/scaffold-eth.md I get 1646250817

Then when I run git log --date=unix --format=%at -n 1 -- builders/build/eth-api/dev-env/scaffold-eth.md I get 1673346506.

@karlgo
Copy link

karlgo commented Mar 20, 2024

@eshaben - Did you figure out your issue? I'm encountering the same thing, even though I do have git logs for the file in question.

@eshaben
Copy link
Author

eshaben commented Mar 21, 2024

@karlgo I implemented a workaround. Created a script that checks if the created data is after the last updated date, and, if so, changes the created date to be the same as the last updated. For reference: https://github.com/moonbeam-foundation/moonbeam-docs/blob/master/js/fixCreatedDate.js

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

No branches or pull requests

3 participants