git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git log --since=<date>
@ 2020-05-01 21:35 Dmitry Kulikov
  2020-05-01 22:03 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Kulikov @ 2020-05-01 21:35 UTC (permalink / raw)
  To: git

Hello, 

I have found a problem.

It turned out, that the timestamp used to determinate which commit is later 
the given date is not at 0h 0m 0s, Instead it is at the current time.

Similarly --until=<date> uses not 23h 59m 59s but also current time.
-- 

With best regards,
   Dmitry Kulikov

mailto:dima@koulikoff.ru
skype: dima.koulikoff
phone: +49 151 6338 5032
Viber, WhatsApp: +7 925 505 2185

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git log --since=<date>
  2020-05-01 21:35 git log --since=<date> Dmitry Kulikov
@ 2020-05-01 22:03 ` Junio C Hamano
  2020-05-02  5:54   ` Dmitry Kulikov
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2020-05-01 22:03 UTC (permalink / raw)
  To: Dmitry Kulikov; +Cc: git

Dmitry Kulikov <dima@koulikoff.ru> writes:

> I have found a problem.
>
> It turned out, that the timestamp used to determinate which commit is later 
> the given date is not at 0h 0m 0s, Instead it is at the current time.
>
> Similarly --until=<date> uses not 23h 59m 59s but also current time.

The behaviour is as designed.  "git log --since=yesterday" does the
same "as nobody said which hour and minute, we take it to mean this
time yesterday".

You of course can say "git log --since=yesterday.midnight" if you
want to be exact ;-).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git log --since=<date>
  2020-05-01 22:03 ` Junio C Hamano
@ 2020-05-02  5:54   ` Dmitry Kulikov
  2020-05-02 11:03     ` Danh Doan
  2020-05-02 12:02     ` Dmitry Kulikov
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Kulikov @ 2020-05-02  5:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Friday 01 May 2020 15:03:10 Junio C Hamano wrote:

> Dmitry Kulikov <dima@koulikoff.ru> writes:
> > I have found a problem.
> > 
> > It turned out, that the timestamp used to determinate which commit is
> > later
> > the given date is not at 0h 0m 0s, Instead it is at the current time.
> > 
> > Similarly --until=<date> uses not 23h 59m 59s but also current time.
> 
> The behaviour is as designed.  "git log --since=yesterday" does the
> same "as nobody said which hour and minute, we take it to mean this
> time yesterday".

  In the documentation it is not described this way. It is said:

       --since=<date>, --after=<date>
           Show commits more recent than a specific date.

  Nothing is said about the time I entered the command.

> You of course can say "git log --since=yesterday.midnight" if you
> want to be exact ;-).

  What should I enter instead --since=2020-05-01 to have a midnight time?

-- 

With best regards,
   Dmitry Kulikov

mailto:dima@koulikoff.ru
skype: dima.koulikoff
phone: +49 151 6338 5032
Viber, WhatsApp: +7 925 505 2185

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git log --since=<date>
  2020-05-02  5:54   ` Dmitry Kulikov
@ 2020-05-02 11:03     ` Danh Doan
  2020-05-02 11:52       ` Dmitry Kulikov
  2020-05-02 16:21       ` Junio C Hamano
  2020-05-02 12:02     ` Dmitry Kulikov
  1 sibling, 2 replies; 7+ messages in thread
From: Danh Doan @ 2020-05-02 11:03 UTC (permalink / raw)
  To: Dmitry Kulikov; +Cc: Junio C Hamano, git

On 2020-05-02 07:54:03+0200, Dmitry Kulikov <dima@koulikoff.ru> wrote:
> On Friday 01 May 2020 15:03:10 Junio C Hamano wrote:
> > You of course can say "git log --since=yesterday.midnight" if you
> > want to be exact ;-).
> 
>   What should I enter instead --since=2020-05-01 to have a midnight time?


You can use the same syntax:

	git log --since='2020-05-01 midnight'
	# or ISO-8601
	git log --since='2020-05-01 00:00:00'


-- 
Danh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git log --since=<date>
  2020-05-02 11:03     ` Danh Doan
@ 2020-05-02 11:52       ` Dmitry Kulikov
  2020-05-02 16:21       ` Junio C Hamano
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Kulikov @ 2020-05-02 11:52 UTC (permalink / raw)
  To: Danh Doan; +Cc: Junio C Hamano, git

On Saturday 02 May 2020 18:03:50 Danh Doan wrote:

> On 2020-05-02 07:54:03+0200, Dmitry Kulikov <dima@koulikoff.ru> wrote:
> > On Friday 01 May 2020 15:03:10 Junio C Hamano wrote:
> > > You of course can say "git log --since=yesterday.midnight" if you
> > > want to be exact ;-).
> > > 
> >   What should I enter instead --since=2020-05-01 to have a midnight time?
> 
> You can use the same syntax:
> 
> 	git log --since='2020-05-01 midnight'
> 	# or ISO-8601
> 	git log --since='2020-05-01 00:00:00'

  Thank you. Please, do not forget to mention that in the documentation.
-- 

With best regards,
   Dmitry Kulikov

mailto:dima@koulikoff.ru
skype: dima.koulikoff
phone: +49 151 6338 5032
Viber, WhatsApp: +7 925 505 2185

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git log --since=<date>
  2020-05-02  5:54   ` Dmitry Kulikov
  2020-05-02 11:03     ` Danh Doan
@ 2020-05-02 12:02     ` Dmitry Kulikov
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Kulikov @ 2020-05-02 12:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Saturday 02 May 2020 7:54:03 Dmitry Kulikov wrote:

> On Friday 01 May 2020 15:03:10 Junio C Hamano wrote:

> > The behaviour is as designed.  "git log --since=yesterday" does the
> > same "as nobody said which hour and minute, we take it to mean this
> > time yesterday".

  After some consideration I still think, that the time if not set explicitly 
should be midnight.

-- 

With best regards,
   Dmitry Kulikov

mailto:dima@koulikoff.ru
skype: dima.koulikoff
phone: +49 151 6338 5032
Viber, WhatsApp: +7 925 505 2185

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git log --since=<date>
  2020-05-02 11:03     ` Danh Doan
  2020-05-02 11:52       ` Dmitry Kulikov
@ 2020-05-02 16:21       ` Junio C Hamano
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2020-05-02 16:21 UTC (permalink / raw)
  To: Danh Doan; +Cc: Dmitry Kulikov, git

Danh Doan <congdanhqx@gmail.com> writes:

> On 2020-05-02 07:54:03+0200, Dmitry Kulikov <dima@koulikoff.ru> wrote:
>> On Friday 01 May 2020 15:03:10 Junio C Hamano wrote:
>> > You of course can say "git log --since=yesterday.midnight" if you
>> > want to be exact ;-).
>> 
>>   What should I enter instead --since=2020-05-01 to have a midnight time?
>
>
> You can use the same syntax:
>
> 	git log --since='2020-05-01 midnight'
> 	# or ISO-8601
> 	git log --since='2020-05-01 00:00:00'

Perhaps the use of <date> in the documentation is what is causing
this confusion?  Would <timestamp> or <datetime> work better?

There is Documentation/date-formats.txt that is included by the help
pages for "git commit-tree", "git commit" and "git tag".  These pages
consistently use "date" and does not say timestamp nor datetime, so
the noun we use in "git log" documentation is OK.

But the date-formats documentation is not included there, so we
would be OK once we

 (1) adjust the contents of the date-formats.txt documentation to
     make sure it can be used in "git log" documentation, and

 (2) find the right place to include it in "git log" documentation.

Here is a rough draft to do so.  I was tempted not to touch
git-log.txt and instead include it in rev-list-options.txt (where
"--since" and friends are described), but the structure of the
document was not ready for that.  If somebody wants to go in that
direction, it might be better as it would allow us to cover things
like "git shortlog --since=3.months.ago", but then we probably
should do the following before we can do so:

 (1) remove the section title and its header level from
     date-formats.txt, and adjust the existing pages that include
     it, and

 (2) find the right place in rev-list-options.txt, and

 (3) make sure everybody that includes rev-list-options.txt are
     happy with the added description (if some of them do not offer
     an option to specify ranges, they must conditionally be
     excluded from using date-formats.txt).

Thanks.

 Documentation/date-formats.txt | 25 ++++++++++++++++++-------
 Documentation/git-commit.txt   |  1 -
 Documentation/git-log.txt      |  2 ++
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
index 6926e0a4c8..ce6f6bdb95 100644
--- a/Documentation/date-formats.txt
+++ b/Documentation/date-formats.txt
@@ -1,11 +1,10 @@
-DATE FORMATS
-------------
+DATE INPUT FORMATS
+------------------
 
-The `GIT_AUTHOR_DATE`, `GIT_COMMITTER_DATE` environment variables
-ifdef::git-commit[]
-and the `--date` option
-endif::git-commit[]
-support the following date formats:
+The `GIT_AUTHOR_DATE`, `GIT_COMMITTER_DATE` environment variables,
+the `--date` option of `git commit`, and
+the options like `--since` of `git log`,
+all of which specify date-time, support the following date formats:
 
 Git internal format::
 	It is `<unix timestamp> <time zone offset>`, where `<unix
@@ -24,3 +23,15 @@ ISO 8601::
 +
 NOTE: In addition, the date part is accepted in the following formats:
 `YYYY.MM.DD`, `MM/DD/YYYY` and `DD.MM.YYYY`.
++
+NOTE: Some human-friendly date and time (e.g. `yesterday`,
+`midnight`, `4 days ago`) are also accepted.  
+The full list is left as trivia for readers to discover.
++
+NOTE: A date-time that lacks time-part is taken to be the same time on
+that day.  For example, `yesterday` used at 8 in the morning means 8 in the
+morning yesterday.  A date-time that lacks date-part is taken to be
+the given time on the same day (if the time has already passed) or
+on the day before (otherwise).  For example, `8AM` used at 9 in the morning
+means an hour ago the same day, while `noon` used at 9 in the morning 
+is taken as the noon the day before.
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index a3baea32ae..70cf5d9d4f 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -494,7 +494,6 @@ the environment variables.
 The typical usage is to set just the `user.name` and `user.email` variables;
 the other options are provided for more complex use cases.
 
-:git-commit: 1
 include::date-formats.txt[]
 
 DISCUSSION
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 20e6d21a74..d2bda18d45 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -109,6 +109,8 @@ options or the revision range, when confusion arises.
 
 include::rev-list-options.txt[]
 
+include::date-formats.txt[]
+
 include::pretty-formats.txt[]
 
 COMMON DIFF OPTIONS

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-02 16:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 21:35 git log --since=<date> Dmitry Kulikov
2020-05-01 22:03 ` Junio C Hamano
2020-05-02  5:54   ` Dmitry Kulikov
2020-05-02 11:03     ` Danh Doan
2020-05-02 11:52       ` Dmitry Kulikov
2020-05-02 16:21       ` Junio C Hamano
2020-05-02 12:02     ` Dmitry Kulikov

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).