Does any know why before
include finish date?
The date 2021-07-01 14:13
actually is after 2021-07-01
Why results are wrong?
git version is 2.32.0
This helps you to clearly see the progress of your project, and to keep track of factors and situations that might cause the finish date to change. A project can only be scheduled from the project start date or from the project finish date at any one time.
Actual finish date: the date on which a card was moved from an active position on the board to the archive to represent work that has been fully completed.
The term finish date refers specifically to the date in which the particular schedule activity as part of the overall project is anticipated to be completed. This term finish date is actually an extremely general one in nature, and is typically never used all by itself in terms of project management.
Note the date filters use the commit datetime, not the author datetime.
Although it isn't documented, as noted in jthill's answer and confirmed by my limited testing, surprisingly, it appears that all the date filters, when a time is not specified, refer to the current time of the day on your client machine! Note you can specify a time if you wish to override that:
git log --before=2021-07-02T23:59:59
(end of the day)
or
git log --before=2021-07-02T00:00:00
(beginning of the day)
Below is my test script. It generates a new repo with one empty commit with a committer date from 2 days ago minus 1 minute. (So that 1 minute from now the commit will be exactly 2 days ago.) Then the script loops for a minute and every 10 seconds it prints out the current time, as well as the log using --before
and --after
options. At first --before doesn't show anything and --after shows the commit, but after a minute the logs flip once the current time surpasses that of the commit date:
#!/bin/bash
# create a test repo
git init
echo ""
# create a date which is 2 days ago minus 1 minute
var1=$(date --date '-2879 min')
# create a date that is the first date in only YYYY-MM-DD format
var2=$(date -d "$var1" +%F)
# show the variables
echo "var1=$var1"
echo "var2=$var2"
echo ""
# create an empty commit with a committer date set to 2 days ago minus 1 minute
GIT_COMMITTER_DATE=$var1 git commit --allow-empty -m 'Create an empty commit'
# display the log; there should only be 1 commit
git log --pretty=fuller
echo ""
# Every 10 seconds for 70 seconds, display the log before 2 days ago without a time specified.
# As soon as the current time passes the time of the commiter_date on the commit, the log will show.
for (( x=1; x<=8; x++ ))
do
echo "Current time: $(date)"
echo "Output of: 'git log --before=$var2':"
git log --before=$var2
echo ""
echo "Output of: 'git log --after=$var2':"
git log --after=$var2
echo ""
sleep 10
done
If you don't specify a time on your cutoff it uses the current wall clock,so --before=yesterday
asked at 5pm means before 5pm yesterday. If you want to specify midnight add T00:00
, --before=yesterday.T00:00
. I have this as surprising enough to count as a full-fledged wart, like find
's behavior with sizes. This is unfortunately used by core commands, so-called "plumbing", and Git has explicitly promised script writers that their behavior and so this date parsing wart won't change.
edit: try this:
unset head; for h in {0..23}; do
head=$( GIT_COMMITTER_DATE=`date -d yesterday\ T$h:00` \
git commit-tree ${head+-p $head} -m - @: )
done
git log -1 --pretty=fuller $head
git log -1 --pretty=fuller --before=yesterday $head
and you'll see that before=yesterday
picks the one with the commit timestamp before the current wall clock.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With