git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Documentation: updated documentation for git commit --date
@ 2021-03-28 10:19 Chinmoy via GitGitGadget
  2021-03-28 12:54 ` [PATCH v2] " Chinmoy via GitGitGadget
  0 siblings, 1 reply; 9+ messages in thread
From: Chinmoy via GitGitGadget @ 2021-03-28 10:19 UTC (permalink / raw)
  To: git; +Cc: Chinmoy, Chinmoy Chakraborty

From: Chinmoy Chakraborty <chinmoy12c@gmail.com>

This commit lists the special strings used with `--date`
in `git-commit.txt` and also a brief explanation about
the strings in `date-formats.txt`.

Signed-off-by: Chinmoy Chakraborty <chinmoy12c@gmail.com>
---
    Documentation: updated documentation for git commit --date
    
    This commit lists the special strings used with --date in git-commit.txt
    and also a brief explanation about the strings in date-formats.txt.
    
    Signed-off-by: Chinmoy Chakraborty chinmoy12c@gmail.com
    
    
    Related Issue
    =============
    
    #302

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-918%2Fchinmoy12c%2Fissue_302-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-918/chinmoy12c/issue_302-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/918

 Documentation/date-formats.txt | 32 ++++++++++++++++++++++++++++++++
 Documentation/git-commit.txt   |  5 ++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
index 99c455f51c04..66dae179eb66 100644
--- a/Documentation/date-formats.txt
+++ b/Documentation/date-formats.txt
@@ -1,6 +1,38 @@
+[[DATE FORMATS]]
 DATE FORMATS
 ------------
 
+`yesterday`::
+	Change commit time to yesterday, that is, 24 hours ago.
+
+`noon`::
+	Change commit time to noon, that is 12:00. If current
+	time is less than 12:00, the time will be set to 12:00
+	on the previous day, else it will be set to 12:00 on
+	the same day.
+
+`midnight`::
+	Change commit time to midnight, that is, 00:00.
+
+`tea`::
+	Change commit time to 17:00(tea time). If the current
+	time is less than 17:00, the time will be set to 17:00
+	on the previous day, else it will be set to 17:00 on
+	the same day.
+
+`PM`::
+	Change commit time from AM to PM. If the current time
+	is already greater than 12:00, then the time remains
+	unaltered.
+
+`AM`::
+	Change commit time from PM to AM. If current time is
+	already less than 12:00, then the time remains
+	unaltered.
+
+`now`::
+	Change commit time to current time.
+
 The `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` environment variables
 support the following date formats:
 
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 3c69f461c9af..b2f51cdcafaf 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -176,7 +176,10 @@ See linkgit:git-rebase[1] for details.
 	the commit author is then copied from the first such commit found.
 
 --date=<date>::
-	Override the author date used in the commit.
+	Override the author date used in the commit. The value of <date>
+	may be any one of the following special values - "yesterday",
+	"noon", "midnight", "tea", "PM", "AM", "never", "now"
+	(see <<DATE FORMATS>>).
 
 -m <msg>::
 --message=<msg>::

base-commit: 84d06cdc06389ae7c462434cb7b1db0980f63860
-- 
gitgitgadget

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

* [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-28 10:19 [PATCH] Documentation: updated documentation for git commit --date Chinmoy via GitGitGadget
@ 2021-03-28 12:54 ` Chinmoy via GitGitGadget
  2021-03-29  5:25   ` Bagas Sanjaya
  2021-03-29 21:27   ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Chinmoy via GitGitGadget @ 2021-03-28 12:54 UTC (permalink / raw)
  To: git; +Cc: Chinmoy, Chinmoy Chakraborty

From: Chinmoy Chakraborty <chinmoy12c@gmail.com>

This commit lists the special strings used with `--date`
in `git-commit.txt` and also a brief explanation about
the strings in `date-formats.txt`.

Signed-off-by: Chinmoy Chakraborty <chinmoy12c@gmail.com>
---
    Documentation: updated documentation for git commit --date
    
    This commit lists the special strings used with --date in git-commit.txt
    and also a brief explanation about the strings in date-formats.txt.
    
    Signed-off-by: Chinmoy Chakraborty chinmoy12c@gmail.com
    
    
    Related Issue
    =============
    
    #302

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-918%2Fchinmoy12c%2Fissue_302-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-918/chinmoy12c/issue_302-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/918

Range-diff vs v1:

 1:  818ac39b5203 ! 1:  20da93dea971 Documentation: updated documentation for git commit --date
     @@ Commit message
      
       ## Documentation/date-formats.txt ##
      @@
     -+[[DATE FORMATS]]
     ++[[DATE-FORMATS]]
       DATE FORMATS
       ------------
       
     @@ Documentation/git-commit.txt: See linkgit:git-rebase[1] for details.
      +	Override the author date used in the commit. The value of <date>
      +	may be any one of the following special values - "yesterday",
      +	"noon", "midnight", "tea", "PM", "AM", "never", "now"
     -+	(see <<DATE FORMATS>>).
     ++	(see <<DATE-FORMATS>>).
       
       -m <msg>::
       --message=<msg>::


 Documentation/date-formats.txt | 32 ++++++++++++++++++++++++++++++++
 Documentation/git-commit.txt   |  5 ++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
index 99c455f51c04..83c423a3ec2e 100644
--- a/Documentation/date-formats.txt
+++ b/Documentation/date-formats.txt
@@ -1,6 +1,38 @@
+[[DATE-FORMATS]]
 DATE FORMATS
 ------------
 
+`yesterday`::
+	Change commit time to yesterday, that is, 24 hours ago.
+
+`noon`::
+	Change commit time to noon, that is 12:00. If current
+	time is less than 12:00, the time will be set to 12:00
+	on the previous day, else it will be set to 12:00 on
+	the same day.
+
+`midnight`::
+	Change commit time to midnight, that is, 00:00.
+
+`tea`::
+	Change commit time to 17:00(tea time). If the current
+	time is less than 17:00, the time will be set to 17:00
+	on the previous day, else it will be set to 17:00 on
+	the same day.
+
+`PM`::
+	Change commit time from AM to PM. If the current time
+	is already greater than 12:00, then the time remains
+	unaltered.
+
+`AM`::
+	Change commit time from PM to AM. If current time is
+	already less than 12:00, then the time remains
+	unaltered.
+
+`now`::
+	Change commit time to current time.
+
 The `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` environment variables
 support the following date formats:
 
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 3c69f461c9af..1935fad33f35 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -176,7 +176,10 @@ See linkgit:git-rebase[1] for details.
 	the commit author is then copied from the first such commit found.
 
 --date=<date>::
-	Override the author date used in the commit.
+	Override the author date used in the commit. The value of <date>
+	may be any one of the following special values - "yesterday",
+	"noon", "midnight", "tea", "PM", "AM", "never", "now"
+	(see <<DATE-FORMATS>>).
 
 -m <msg>::
 --message=<msg>::

base-commit: 84d06cdc06389ae7c462434cb7b1db0980f63860
-- 
gitgitgadget

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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-28 12:54 ` [PATCH v2] " Chinmoy via GitGitGadget
@ 2021-03-29  5:25   ` Bagas Sanjaya
  2021-03-29  6:02     ` Chinmoy Chakraborty
  2021-03-29 21:27   ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Bagas Sanjaya @ 2021-03-29  5:25 UTC (permalink / raw)
  To: Chinmoy via GitGitGadget; +Cc: Chinmoy, git

On 28/03/21 19.54, Chinmoy via GitGitGadget wrote:
> From: Chinmoy Chakraborty <chinmoy12c@gmail.com>
> 
> This commit lists the special strings used with `--date`
> in `git-commit.txt` and also a brief explanation about
> the strings in `date-formats.txt`.
> 
> Signed-off-by: Chinmoy Chakraborty <chinmoy12c@gmail.com>
> ---
Is date format parsing specific to git commit? If so, then
why not date-formats.txt be merged to `DATE FORMATS` section
of git-commit documentation? Also, what commit this `--date`
option first appeared before you write this documentation?

> +`tea`::
> +	Change commit time to 17:00(tea time). If the current
> +	time is less than 17:00, the time will be set to 17:00
> +	on the previous day, else it will be set to 17:00 on
> +	the same day.
How useful is this argument?

-- 
An old man doll... just what I always wanted! - Clara

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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-29  5:25   ` Bagas Sanjaya
@ 2021-03-29  6:02     ` Chinmoy Chakraborty
  2021-03-29 11:11       ` Bagas Sanjaya
  0 siblings, 1 reply; 9+ messages in thread
From: Chinmoy Chakraborty @ 2021-03-29  6:02 UTC (permalink / raw)
  To: Bagas Sanjaya, git


On 3/29/21 10:55 AM, Bagas Sanjaya wrote:
> Is date format parsing specific to git commit? If so, then
> why not date-formats.txt be merged to `DATE FORMATS` section
> of git-commit documentation?
It is already included below the `COMMIT INFORMATION` section.

> Also, what commit this `--date`
> option first appeared before you write this documentation?

I guess it was introduced in commit 
a8aca418d6484400d6804e22717bd49ca06c28e9.

>
>> +`tea`::
>> +    Change commit time to 17:00(tea time). If the current
>> +    time is less than 17:00, the time will be set to 17:00
>> +    on the previous day, else it will be set to 17:00 on
>> +    the same day.
> How useful is this argument?
>
I think initially it was suggested as a joke, but actually implemented

to demonstrate the ability for users to include their own custom

time/date periods.

See : 
https://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9


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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-29  6:02     ` Chinmoy Chakraborty
@ 2021-03-29 11:11       ` Bagas Sanjaya
  2021-03-29 14:56         ` Chinmoy Chakraborty
  0 siblings, 1 reply; 9+ messages in thread
From: Bagas Sanjaya @ 2021-03-29 11:11 UTC (permalink / raw)
  To: Chinmoy Chakraborty, git; +Cc: Junio C Hamano

On 29/03/21 13.02, Chinmoy Chakraborty wrote:

> I think initially it was suggested as a joke, but actually implemented
> 
> to demonstrate the ability for users to include their own custom
> 
> time/date periods.
> 
Hmmm...

The commit you mentioned (a8aca418d6484400d6804e22717bd49ca06c28e9)
said that:

>     Thanks for pointing out tea-time.
> 
>     This is also written to easily extended to allow people to add their own
>     important dates like Christmas and their own birthdays.
> 

But it seems like the predefined dates/times were hard-coded, so to extend
--date option to allow more predefined date/times, Git sources need to
be edited.

Maybe we can make git config option (commit.predefined_times [FIXME: suggest
better name]) so user can easily add ones.

Also, I asked to you: can I set --date to arbitrary date (like 09/29/2009
19:59)?

[CC] Junio, what about this patch?

-- 
An old man doll... just what I always wanted! - Clara

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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-29 11:11       ` Bagas Sanjaya
@ 2021-03-29 14:56         ` Chinmoy Chakraborty
  0 siblings, 0 replies; 9+ messages in thread
From: Chinmoy Chakraborty @ 2021-03-29 14:56 UTC (permalink / raw)
  To: Bagas Sanjaya, git


On 3/29/21 4:41 PM, Bagas Sanjaya wrote:
>
> Also, I asked to you: can I set --date to arbitrary date (like 09/29/2009
> 19:59)?


Sure you can use something like git commit --date='2009-09-29 19:59:00'

or git commit --date=`2 days ago`


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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-28 12:54 ` [PATCH v2] " Chinmoy via GitGitGadget
  2021-03-29  5:25   ` Bagas Sanjaya
@ 2021-03-29 21:27   ` Junio C Hamano
  2021-03-30 16:38     ` Chinmoy Chakraborty
  1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2021-03-29 21:27 UTC (permalink / raw)
  To: Chinmoy via GitGitGadget; +Cc: git, Chinmoy

"Chinmoy via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Chinmoy Chakraborty <chinmoy12c@gmail.com>
>
> This commit lists the special strings used with `--date`
> in `git-commit.txt` and also a brief explanation about
> the strings in `date-formats.txt`.

All of that can be read from the patch text.  What an author is
expected to explain in the proposed commit log message is WHY.

Why is it a good idea to list possible arguments --date can take?

The reason can include "because so far they are not explained
anywhere."

Documentation/SubmittingPatches::describe-changes, especially
[[meaningful-message]], is a good source to learn what a title and a
proposed log message of a patch should look like in this project.

> diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
> index 99c455f51c04..83c423a3ec2e 100644
> --- a/Documentation/date-formats.txt
> +++ b/Documentation/date-formats.txt
> @@ -1,6 +1,38 @@
> +[[DATE-FORMATS]]
>  DATE FORMATS
>  ------------
>  
> +`yesterday`::
> +	Change commit time to yesterday, that is, 24 hours ago.
> +
> +`noon`::
> +	Change commit time to noon, that is 12:00. If current
> +	time is less than 12:00, the time will be set to 12:00
> +	on the previous day, else it will be set to 12:00 on
> +	the same day.
> +
> +`midnight`::
> +	Change commit time to midnight, that is, 00:00.
> +
> +`tea`::
> +	Change commit time to 17:00(tea time). If the current
> +	time is less than 17:00, the time will be set to 17:00
> +	on the previous day, else it will be set to 17:00 on
> +	the same day.
> +
> +`PM`::
> +	Change commit time from AM to PM. If the current time
> +	is already greater than 12:00, then the time remains
> +	unaltered.
> +
> +`AM`::
> +	Change commit time from PM to AM. If current time is
> +	already less than 12:00, then the time remains
> +	unaltered.
> +
> +`now`::
> +	Change commit time to current time.

The "commit" related documentation is not the only consumer of this
file.  These new descriptions repeatedly stress "commit time", but
are these acceptable to readers of other page(s) that include this
file, or is the discrepancy irritating to them?

In any case, I personally think these should NOT be described at the
beginning of this file.  The primary formats the end-users should
learn to use are the ones that are described already in the
document.  All of the above are more like "by the way, did you know
that 'git-commit --date' takes these cute strings? easter eggs.

I am not very strongly opposed to extending the tail end of the
existing contents of the file, namely:

    ifdef::git-commit[]
    In addition to recognizing all date formats above, the `--date` option
    will also try to make sense of other, more human-centric date formats,
    such as relative dates like "yesterday" or "last Friday at noon".
    endif::git-commit[]

and explain what "such as ..." is, but I am fairly negative on
teaching 'tea' to our users before we talk about 2822 and 8601
formats.  I actually think the above three lines strikes a good
balance---we do not want the users to be surprised too much when
they see "--date yesterday" to work, but we do not particularly
want to encourage them to use "commit --date noon" [*1*].

>  The `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` environment variables
>  support the following date formats:
>  
> diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
> index 3c69f461c9af..1935fad33f35 100644
> --- a/Documentation/git-commit.txt
> +++ b/Documentation/git-commit.txt
> @@ -176,7 +176,10 @@ See linkgit:git-rebase[1] for details.
>  	the commit author is then copied from the first such commit found.
>  
>  --date=<date>::
> -	Override the author date used in the commit.
> +	Override the author date used in the commit. The value of <date>
> +	may be any one of the following special values - "yesterday",
> +	"noon", "midnight", "tea", "PM", "AM", "never", "now"
> +	(see <<DATE-FORMATS>>).

Likewise.  I am OK with adding (see date-formats) but against
listing the easter eggs as if they are more important than other
forms.

Thanks.


[Footnote]

*1* The approxidate is useful when a rough "around that time"
    specification suffices, e.g. "git log --since='last.week'".  The
    user is OK to see commits down to roughly a week old, and would
    not be upset if a commit with a timestamp that is 9 days old
    shown.

    On the other hand, it would be unusual that somebody cares
    enough to use "git commit --date" but yet it is OK that the time
    recorded is fuzzy.  For that reason alone, I am in general
    negative on the direction this patch tries to take us in.




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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-29 21:27   ` Junio C Hamano
@ 2021-03-30 16:38     ` Chinmoy Chakraborty
  2021-03-30 17:28       ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Chinmoy Chakraborty @ 2021-03-30 16:38 UTC (permalink / raw)
  To: git


On 3/30/21 2:57 AM, Junio C Hamano wrote:
> All of that can be read from the patch text.  What an author is
> expected to explain in the proposed commit log message is WHY.
>
> Why is it a good idea to list possible arguments --date can take?
>
> The reason can include "because so far they are not explained
> anywhere."
>
> Documentation/SubmittingPatches::describe-changes, especially
> [[meaningful-message]], is a good source to learn what a title and a
> proposed log message of a patch should look like in this project.

Okay I'll update the patch with proper commit message.


> I am not very strongly opposed to extending the tail end of the
> existing contents of the file, namely:
>
>      ifdef::git-commit[]
>      In addition to recognizing all date formats above, the `--date` option
>      will also try to make sense of other, more human-centric date formats,
>      such as relative dates like "yesterday" or "last Friday at noon".
>      endif::git-commit[]
>
> and explain what "such as ..." is, but I am fairly negative on
> teaching 'tea' to our users before we talk about 2822 and 8601
> formats.  I actually think the above three lines strikes a good
> balance---we do not want the users to be surprised too much when
> they see "--date yesterday" to work, but we do not particularly
> want to encourage them to use "commit --date noon" [*1*].

Okay so I guess it's better to just extend the tail of the file

to explain a little bit about the relative dates and leave

out the Easter eggs and formats like 'noon' and 'midnight'


> Likewise.  I am OK with adding (see date-formats) but against
> listing the easter eggs as if they are more important than other
> forms.

Okay I'll just add the (see date-formats) and leave out the

exhaustive list.


>
> [Footnote]
>
> *1* The approxidate is useful when a rough "around that time"
>      specification suffices, e.g. "git log --since='last.week'".  The
>      user is OK to see commits down to roughly a week old, and would
>      not be upset if a commit with a timestamp that is 9 days old
>      shown.
>
>      On the other hand, it would be unusual that somebody cares
>      enough to use "git commit --date" but yet it is OK that the time
>      recorded is fuzzy.  For that reason alone, I am in general
>      negative on the direction this patch tries to take us in.

So according to you, is it a relevant/worthwhile change

to add in docs?


Thanks.


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

* Re: [PATCH v2] Documentation: updated documentation for git commit --date
  2021-03-30 16:38     ` Chinmoy Chakraborty
@ 2021-03-30 17:28       ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2021-03-30 17:28 UTC (permalink / raw)
  To: Chinmoy Chakraborty; +Cc: git

Chinmoy Chakraborty <chinmoy12c@gmail.com> writes:

>> [Footnote]
>>
>> *1* The approxidate is useful when a rough "around that time"
>>      specification suffices, e.g. "git log --since='last.week'".  The
>>      user is OK to see commits down to roughly a week old, and would
>>      not be upset if a commit with a timestamp that is 9 days old
>>      shown.
>>
>>      On the other hand, it would be unusual that somebody cares
>>      enough to use "git commit --date" but yet it is OK that the time
>>      recorded is fuzzy.  For that reason alone, I am in general
>>      negative on the direction this patch tries to take us in.
>
> So according to you, is it a relevant/worthwhile change
>
> to add in docs?

That depends on the "docs".

If we do not hint that relative dates are also usable, in addition
to the more common date formats like RFC2822 and ISO8601, for "log
--since" and other options that are used to specify a boundary for
looking up existing things, extending their documentation may be
worth doing.

Giving 'tea' and other oddities at the top as if they are more
important than the formats that is used to give more precise input
for options that are used to specify what timestamp is recorded in
an object the command is about to create would be a change with
negative value.

Thanks.

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

end of thread, other threads:[~2021-03-30 17:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 10:19 [PATCH] Documentation: updated documentation for git commit --date Chinmoy via GitGitGadget
2021-03-28 12:54 ` [PATCH v2] " Chinmoy via GitGitGadget
2021-03-29  5:25   ` Bagas Sanjaya
2021-03-29  6:02     ` Chinmoy Chakraborty
2021-03-29 11:11       ` Bagas Sanjaya
2021-03-29 14:56         ` Chinmoy Chakraborty
2021-03-29 21:27   ` Junio C Hamano
2021-03-30 16:38     ` Chinmoy Chakraborty
2021-03-30 17:28       ` Junio C Hamano

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).