Fix the helper script to find the year of first commit of a file to show the right year
I am looking at the helper scripts – https://reuse.readthedocs.io/en/stable/scripts.html#year-of-first-commit – and see an issue.
Namely, if you run that on a file, it can find the wrong year. I just hit that bug myself!
As such I would suggest we change the helper script to the much more reliable:
git log --follow --format=%as $file | tail -n1 | cut -c-4
We could also mention --find-renames as an option some might want to make use of.
Further (short) reading: https://kgrz.io/use-git-log-follow-for-file-history.html
Should we add --follow to more commands?
The --reverse option with head should be faster if I recall correctly. But perhaps less readable.
I’m not a Git expert by any means, but from what I understand --reverse … | head should be faster, but --follow should be more exact.
Thank you for your time and contributions! Unfortunately, this issue has been inactive for quite a while which means we probably can't manage the time to deal with it. That's why we're marking it as stale. We want to keep things tidy and focus on active discussions, but we’re always happy to revisit if this is still relevant!
If you’d like to keep this open, please add a comment to let us know and remove the label stale. Otherwise, this issue will most likely be automatically closed soon.
This issue is still relevant.
Hi! This repository is being migrated away from GitHub towards Codeberg. More context can be found in #865. This issue can henceforth be found at https://codeberg.org/fsfe/reuse-tool/issues/618. Any comments subsequent to this comment will not be migrated.