mkdocs-rss-plugin
mkdocs-rss-plugin copied to clipboard
Attempt to extract date from only the last line of git log output
Previously, the code assumes the output of git log --format="%at" only
contains commit timestamp. But this is not true.
--format only controls a portion of the output. git log command can
output additional information thats not controlled by format. e.g.: When
showSignature is set, it will always display commit signature info.
This commit attempts to locate timestamps only from the very last line
of git log output.
Fixes #124
I am not super familiar with all the possible options in git that may affect the output of git log. There could have been other cases I haven't thought about. However, limiting the timestamp extraction to only the last line of git log output fixed the issue for me at least. Please let me know if you have suggestions!
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 81.21%. Comparing base (
3dabb2c) to head (293a902).
:exclamation: Current head 293a902 differs from pull request most recent head e950034
Please upload reports for the commit e950034 to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## main #125 +/- ##
==========================================
- Coverage 85.04% 81.21% -3.84%
==========================================
Files 10 5 -5
Lines 555 330 -225
Branches 117 76 -41
==========================================
- Hits 472 268 -204
+ Misses 53 40 -13
+ Partials 30 22 -8
| Flag | Coverage Δ | |
|---|---|---|
| unittests | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files | Coverage Δ | |
|---|---|---|
| mkdocs_rss_plugin/util.py | 71.42% <ø> (-3.78%) |
:arrow_down: |
It looks good to me but maybe an unit test would be better, to compare result between with/out the --show-signature option. What do you think?
@Guts
Thanks for the suggestion. I think that's a great idea. Looks like the lines I touched are part of a very long method, get_file_dates, which attempts to extract dates in various ways. What do you think if we refactor it a bit and move the git log extraction logic into a dedicated string parsing method? Then I can mock some git log outputs to test just that method.
What do you think if we refactor it a bit and move the git log extraction logic into a dedicated string parsing method? Then I can mock some git log outputs to test just that method.
Good idea! Please, make yourself comfortable, go ahead!
Hi @yuha0!
Do you need some help or review to achieve this?
@Guts Sorry about the delay, It's been busy at work. Also, for some reason I cannot reproduce it on my personal device... I will need to investigate a bit more
@yuha0 no worries, take the time you have. I just needed to know if it's still an active work here or if it's stale.
Can you set this PR to draft status in the meanwhile?
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Hey @yuha0,
Any chance to see this work achieved?
I close here since it's has been 2 years without any push (except rebase), but don't hesitate to reopen.