git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philip Oakley <philipoakley@iee.email>
To: ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: "René Scharfe" <l.s.r@web.de>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Taylor Blau" <me@ttaylorr.com>,
	"ZheNing Hu" <adlternative@gmail.com>
Subject: Re: [PATCH v2] [GSOC] pretty: provide human date format
Date: Sat, 24 Apr 2021 20:44:48 +0100	[thread overview]
Message-ID: <c0780b56-8852-d055-97ec-45ff93aa41de@iee.email> (raw)
In-Reply-To: <pull.939.v2.git.1619275340051.gitgitgadget@gmail.com>

quoting nit..
On 24/04/2021 15:42, ZheNing Hu via GitGitGadget wrote:
> From: ZheNing Hu <adlternative@gmail.com>
>
> Add the placeholders %ah and %ch to format author date and committer
> date, like --date=human does, which provides more humanity date output.
>
> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
> ---
>     [GSOC] pretty: provide human date format
>     
>     Reasons for making this patch: --date=human has no corresponding
>     --pretty option.
>     
>     Although --date=human with --pretty="%(a|c)d" can achieve the same
>     effect with --pretty="%(a|c)h", but it can be noticed that most time
>     formats implement the corresponding option of --pretty, such as
>     --date=iso8601 can be replaced by --pretty=%(a|c)i, so add
>     "--pretty=%(a|c)h" seems to be a very reasonable thing.
>     
>     Change from v1: add %(a|c)h link to rev-list-options.txt.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v2
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v2
> Pull-Request: https://github.com/gitgitgadget/git/pull/939
>
> Range-diff vs v1:
>
>  1:  ed8abd6179d1 ! 1:  1517708876b5 [GSOC] pretty: provide human date format
>      @@ Documentation/pretty-formats.txt: The placeholders are:
>        '%ai':: author date, ISO 8601-like format
>        '%aI':: author date, strict ISO 8601 format
>        '%as':: author date, short format (`YYYY-MM-DD`)
>      -+'%ah':: author date, human style
>      ++'%ah':: author date, human style (like the --date=human option of
>      ++	linkgit:rev-list-options.txt[1])
>        '%cn':: committer name
>        '%cN':: committer name (respecting .mailmap, see
>        	linkgit:git-shortlog[1] or linkgit:git-blame[1])
>      @@ Documentation/pretty-formats.txt: The placeholders are:
>        '%ci':: committer date, ISO 8601-like format
>        '%cI':: committer date, strict ISO 8601 format
>        '%cs':: committer date, short format (`YYYY-MM-DD`)
>      -+'%ch':: committer date, human style
>      ++'%ch':: committer date, human style(like the --date=human option of
>      ++	linkgit:rev-list-options.txt[1])
>        '%d':: ref names, like the --decorate option of linkgit:git-log[1]
>        '%D':: ref names without the " (", ")" wrapping.
>        '%(describe[:options])':: human-readable name, like
>
>
>  Documentation/pretty-formats.txt | 4 ++++
>  pretty.c                         | 3 +++
>  t/t4205-log-pretty-formats.sh    | 6 ++++++
>  3 files changed, 13 insertions(+)
>
> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
> index 45133066e412..e37d5cbb6b16 100644
> --- a/Documentation/pretty-formats.txt
> +++ b/Documentation/pretty-formats.txt
> @@ -190,6 +190,8 @@ The placeholders are:
>  '%ai':: author date, ISO 8601-like format
>  '%aI':: author date, strict ISO 8601 format
>  '%as':: author date, short format (`YYYY-MM-DD`)
> +'%ah':: author date, human style (like the --date=human option of
shouldn't that option be quoted " `--date=human` " so as to match the
format in rev-list?
> +	linkgit:rev-list-options.txt[1])
Also. Is this right? Shouldn't it just link to the dashed git- command's
man page, rather than the file, i.e.
 linkgit:git-rev-list[1])
>  '%cn':: committer name
>  '%cN':: committer name (respecting .mailmap, see
>  	linkgit:git-shortlog[1] or linkgit:git-blame[1])
> @@ -206,6 +208,8 @@ The placeholders are:
>  '%ci':: committer date, ISO 8601-like format
>  '%cI':: committer date, strict ISO 8601 format
>  '%cs':: committer date, short format (`YYYY-MM-DD`)
> +'%ch':: committer date, human style(like the --date=human option of
likewise, quote the option ? and resolve the linkgit: to the man page
> +	linkgit:rev-list-options.txt[1])
>  '%d':: ref names, like the --decorate option of linkgit:git-log[1]
>  '%D':: ref names without the " (", ")" wrapping.
>  '%(describe[:options])':: human-readable name, like
> diff --git a/pretty.c b/pretty.c
> index e5b33ba034bd..b1ecd039cef2 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,
>  	case 'I':	/* date, ISO 8601 strict */
>  		strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));
>  		return placeholder_len;
> +	case 'h':	/* date, human */
> +		strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));
> +		return placeholder_len;
>  	case 's':
>  		strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));
>  		return placeholder_len;
> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
> index cabdf7d57a00..d4d75b0b350e 100755
> --- a/t/t4205-log-pretty-formats.sh
> +++ b/t/t4205-log-pretty-formats.sh
> @@ -539,6 +539,12 @@ test_expect_success 'short date' '
>  	test_cmp expected actual
>  '
>  
> +test_expect_success 'human date' '
> +	git log --format=%ad%n%cd --date=human >expected &&
> +	git log --format=%ah%n%ch >actual &&
> +	test_cmp expected actual
> +'
> +
>  # get new digests (with no abbreviations)
>  test_expect_success 'set up log decoration tests' '
>  	head1=$(git rev-parse --verify HEAD~0) &&
>
> base-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a
Looks good otherwise.
Philip

  reply	other threads:[~2021-04-24 19:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 16:27 [PATCH] [GSOC] pretty: provide human date format ZheNing Hu via GitGitGadget
2021-04-23 20:21 ` Taylor Blau
2021-04-24 13:26   ` ZheNing Hu
2021-04-23 21:10 ` Philip Oakley
2021-04-24 13:33   ` ZheNing Hu
2021-04-24 14:42 ` [PATCH v2] " ZheNing Hu via GitGitGadget
2021-04-24 19:44   ` Philip Oakley [this message]
2021-04-25  9:11   ` [PATCH 0/2] pretty tests: --date/format test improvements Ævar Arnfjörð Bjarmason
2021-04-25  9:11     ` [PATCH 1/2] pretty tests: simplify %aI/%cI date format test Ævar Arnfjörð Bjarmason
2021-04-26 21:22       ` Beat Bolli
2021-04-27  7:08       ` Junio C Hamano
2021-04-25  9:11     ` [PATCH 2/2] pretty tests: give --date/format tests a better description Ævar Arnfjörð Bjarmason
2021-04-25  9:30       ` ZheNing Hu
2021-04-25 10:41   ` [PATCH v3] [GSOC] pretty: provide human date format ZheNing Hu via GitGitGadget
2021-05-03 15:37     ` [PATCH v4] " ZheNing Hu via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0780b56-8852-d055-97ec-45ff93aa41de@iee.email \
    --to=philipoakley@iee.email \
    --cc=adlternative@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=me@ttaylorr.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).