arzzen / git-quick-stats

▁▅▆▃▅ Git quick statistics is a simple and efficient way to access various statistics in git repository.
https://git-quick-stats.sh/
MIT License
6.27k stars 249 forks source link

Commits reported for Dec 2021 but that month is yet to come #123

Closed mhow2 closed 1 year ago

mhow2 commented 3 years ago

Describe the bug 2 commit are reported for Dec 2021 but that month is yet to come

To Reproduce

$ git clone https://github.com/sympa-community/sympa.git
$ cd sympa
$ _GIT_SINCE="2021-01-01" _GIT_UNTIL="2021-03-01" git-quick-stats -m

2 commits are reported in Dec 2021.

git log |grep Date | grep 2021 | grep Dec doesn't match the observation.

Expected behavior No commit in Dec 2021

henrythebuilder commented 3 years ago

Hi, first of all thanks for your work, I have a problem with the updated version, it seems that the filter introduced for the months/weekdays/hours does not work. In my tests it filters the log only on 'since' and 'until' year, but maybe it's just my problem with date / timezone management, however to reproduce the problem I have done the following:

git clone https://github.com/sympa-community/sympa.git
cd sympa
_GIT_SINCE="2019-12-31" _GIT_UNTIL="2021-03-01" git-quick-stats -m

and the result seams not consider the year 2020. Maybe the initial problem is due to the commit date timezone for f9d15f68 (Wed Dec 30 16:48:03 2020 +0900) and not to the filters used by git-quick-stats

Enrico

kronthto commented 3 years ago

The timezone is probably not the issue, but commits have 2 dates (Author & Commit):

$ git show f9d15f68 --pretty=fuller
commit f9d15f68c5dc6a3865bf0f9163b1aae05372c55d
AuthorDate: Wed Dec 30 16:48:03 2020 +0900
CommitDate: Fri Jan 1 12:40:05 2021 +0900

It appears people in this repo have either "faked" one of them or amended to commits later because normally (in my experience) they are the same.

The --since filter appears to apply to the CommitDate while the output used by this tool appears to get the AuthorDate.

henrythebuilder commented 3 years ago

You are right, git log orders logs according to the commit date even if the author date is displayed. As far as I know when a commit is created two timestamps was made based on current time: author date and commit date. Author date refer to the time where the commit was made and it never change. The commit date seems to be changed every time the commit is being modified (ie rebasing, merge from a git-mail or similar), so for me is possible to have different date/time for the same commit. An alternative test could be the --date=iso-local flag together with the --author-date-order flag in order to retrieve logs by the author date order in the local time zone:

git show f9d15f68 --date=iso-local --pretty=fuller commit f9d15f68c5dc6a3865bf0f9163b1aae05372c55d Author: IKEDA Soji ikeda@conversion.co.jp AuthorDate: 2020-12-30 08:48:03 +0100 Commit: IKEDA Soji ikeda@conversion.co.jp CommitDate: 2021-01-01 04:40:05 +0100

Update documentation

...

tomice commented 3 years ago

Note for maintainers (mostly a note to me): see #130 for additional information, steps to reproduce, and some other potential fixes.