Skip to content

Option to ignore commits about move operations #147

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

Closed
skywarth opened this issue Sep 24, 2024 · 4 comments
Closed

Option to ignore commits about move operations #147

skywarth opened this issue Sep 24, 2024 · 4 comments

Comments

@skywarth
Copy link
Contributor

Hi there,

I just got started with using this plugin but ran into something which might be worth considering as a future. So recently I moved all my md files into a singular folder, and committed like so, hence the last change date of all my notes are pointing to that date, which is sub optimal because it is not an actual change, just a move operation. So how about an option to disregards last commit if it is a move operation, and doesn't contain any actual changes in the file itself?

Here's an example scenario:

  • Date: 13/01/2002, file moved (ignore)
  • Date 05/01/2002, file moved (ignore)
  • Date: 04:/01/2002, nominal commit, some change in the file (use this)
  • Date: 01:/01/2002, nominal commit, some change in the file (not the latest)

Just a thought: move operations can be determined if file contents are identical per hash.

This feature could come in handy, what do you think?

If it is a considerable feature, I might try to take a crack at it.

Thank you

@timvink
Copy link
Owner

timvink commented Sep 25, 2024

Hee, that's a good one!

I think we can add that by adding a diff filter "r". See
https://stackoverflow.com/questions/15130597/git-log-exclude-renames

It should be added here:

realpath, date="unix", format="%at", n=1, no_show_signature=True

And here's an example of how to add the diff filter argument, as we already use it for the creation date.

realpath, date="unix", format="%at", diff_filter="A", no_show_signature=True, follow=True

Would appreciate a PR!

@skywarth
Copy link
Contributor Author

Hee, that's a good one!

I think we can add that by adding a diff filter "r". See https://stackoverflow.com/questions/15130597/git-log-exclude-renames

It should be added here:

realpath, date="unix", format="%at", n=1, no_show_signature=True

And here's an example of how to add the diff filter argument, as we already use it for the creation date.

realpath, date="unix", format="%at", diff_filter="A", no_show_signature=True, follow=True

Would appreciate a PR!

Thank you for the leads, I'll try to open up a PR for this feature. Though I'm not really proficient with Python or pip package development environment, I'll try my best 😄

I suppose Contributing guide is where I gotta start from? Any other tips for setting it up for dev environment?

Thank you

@timvink
Copy link
Owner

timvink commented Sep 25, 2024

Brave venturing into python.

Two tips: 1) editable installs (pip install -e .)
2) you can add breakpoint() anywhere in the code, then run of the test examples with mkdocs serve -f path-to-mkdocs.yml (or add a new one, or use your own project)

Perhaps you could setup two repos locally, where one had a rename in the commit history and the other doesn't. The you can verify it works.

Good luck, and no worries if you get stuck. Oh and remember open source is supposed to be fun, no pressure or rush at all!

@timvink
Copy link
Owner

timvink commented Oct 22, 2024

Released: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/releases/tag/v1.3.0

@timvink timvink closed this as completed Oct 22, 2024
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

2 participants