timvink / mkdocs-git-revision-date-localized-plugin

MkDocs plugin to add a last updated date to your site pages
https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html
MIT License
206 stars 44 forks source link

Add support for symlinks #41

Closed AndreasBieber closed 4 years ago

AndreasBieber commented 4 years ago

This PR adds support for symlinks (e.g. having git submodules in the repo):

.
└── repo
    ├── another-repo # git submodule
    │   └── docs
    │       └── index.md
    ├── docs
    │   ├── index.md
    │   └── sub-topic -> /repo/another-repo/docs/
    └── mkdocs.yaml
timvink commented 4 years ago

Thanks for your contribution! Nice work!

Elegant solution. I briefly thought there might be a performance hit by determining a repo for each file, but you solved that nicely by caching the directory of a file, so should be fine.

Just one question, is there any reason you choose to put this line in get_revision_date_for_file() instead of _get_repo() ?

https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/blob/ee43666510e44e7d16746c272de81945f2fa7f26/mkdocs_git_revision_date_localized_plugin/util.py#L90

AndreasBieber commented 4 years ago

Yes, because the realpath is also needed when calling log. Otherwise git will complain that the path is outside of the repository.

timvink commented 4 years ago

Thanks @AndreasBieber 🎉

Will release a new version of this plugin tomorrow

AndreasBieber commented 4 years ago

Thx for the fast response and merge!