{"thread":{"id":"55546","subject":"[PATCH] [GSOC] pretty: provide human date format","startedAt":"2021-04-23T16:27:29Z","lastAt":"2021-05-03T15:37:08Z","messageCount":15,"participants":["ZheNing Hu via GitGitGadget","Taylor Blau","Philip Oakley","ZheNing Hu","Ævar Arnfjörð Bjarmason","Beat Bolli","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"422764","messageId":"pull.939.git.1619195245606.gitgitgadget@gmail.com","threadId":"55546","inReplyTo":null,"subject":"[PATCH] [GSOC] pretty: provide human date format","fromName":"ZheNing Hu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-04-23T16:27:25Z","receivedAt":"2021-04-23T16:27:29Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"From: ZheNing Hu <adlternative@gmail.com>\n\nAdd the placeholders %ah and %ch to format author date and committer\ndate, like --date=human does, which provides more humanity date output.\n\nSigned-off-by: ZheNing Hu <adlternative@gmail.com>\n---\n    [GSOC] pretty: provide human date format\n    \n    Reasons for making this patch: --date=human has no corresponding\n    --pretty option.\n    \n    Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n    effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n    formats implement the corresponding option of --pretty, such as\n    --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n    \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/939\n\n Documentation/pretty-formats.txt | 2 ++\n pretty.c                         | 3 +++\n t/t4205-log-pretty-formats.sh    | 6 ++++++\n 3 files changed, 11 insertions(+)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 45133066e412..9cdcdb8bb414 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -190,6 +190,7 @@ The placeholders are:\n '%ai':: author date, ISO 8601-like format\n '%aI':: author date, strict ISO 8601 format\n '%as':: author date, short format (`YYYY-MM-DD`)\n+'%ah':: author date, human style\n '%cn':: committer name\n '%cN':: committer name (respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n@@ -206,6 +207,7 @@ The placeholders are:\n '%ci':: committer date, ISO 8601-like format\n '%cI':: committer date, strict ISO 8601 format\n '%cs':: committer date, short format (`YYYY-MM-DD`)\n+'%ch':: committer date, human style\n '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n '%D':: ref names without the \" (\", \")\" wrapping.\n '%(describe[:options])':: human-readable name, like\ndiff --git a/pretty.c b/pretty.c\nindex e5b33ba034bd..b1ecd039cef2 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tcase 'I':\t/* date, ISO 8601 strict */\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n \t\treturn placeholder_len;\n+\tcase 'h':\t/* date, human */\n+\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n+\t\treturn placeholder_len;\n \tcase 's':\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n \t\treturn placeholder_len;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex cabdf7d57a00..d4d75b0b350e 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -539,6 +539,12 @@ test_expect_success 'short date' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'human date' '\n+\tgit log --format=%ad%n%cd --date=human >expected &&\n+\tgit log --format=%ah%n%ch >actual &&\n+\ttest_cmp expected actual\n+'\n+\n # get new digests (with no abbreviations)\n test_expect_success 'set up log decoration tests' '\n \thead1=$(git rev-parse --verify HEAD~0) &&\n\nbase-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\n-- \ngitgitgadget\n"},{"id":"422813","messageId":"YIMsOV/O2Ss+qaeK@nand.local","threadId":"55546","inReplyTo":"pull.939.git.1619195245606.gitgitgadget@gmail.com","subject":"Re: [PATCH] [GSOC] pretty: provide human date format","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-04-23T20:21:13Z","receivedAt":"2021-04-23T20:21:20Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"Hi ZheNing,\n\nOn Fri, Apr 23, 2021 at 04:27:25PM +0000, ZheNing Hu via GitGitGadget wrote:\n> From: ZheNing Hu <adlternative@gmail.com>\n>\n> Add the placeholders %ah and %ch to format author date and committer\n> date, like --date=human does, which provides more humanity date output.\n\nI don't see a reason why this shouldn't exist, and the patch that you\nwrote below looks pretty good to me.\n\nTo refresh my memory on if you had missed any spots, I followed\n0df621172d (pretty: provide short date format, 2019-11-19) as an\nexample. You did a fine job here, and I don't think this patch is\nmissing anything.\n\n> Signed-off-by: ZheNing Hu <adlternative@gmail.com>\n> ---\n>     [GSOC] pretty: provide human date format\n>\n>     Reasons for making this patch: --date=human has no corresponding\n>     --pretty option.\n>\n>     Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n>     effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n>     formats implement the corresponding option of --pretty, such as\n>     --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n>     \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n\nJust to make sure I understand what you wrote: you're saying that the\npretty formats \"%ah\" and \"%ch\" that you propose here could be achieved\nwith --date=human and --pretty=\"%ad\". Makes sense, but I agree that your\npoint about --date=iso8601 having a built-in pretty atom makes the case\nfor having \"%ah\" and \"%ch\".\n\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/939\n>\n>  Documentation/pretty-formats.txt | 2 ++\n>  pretty.c                         | 3 +++\n>  t/t4205-log-pretty-formats.sh    | 6 ++++++\n>  3 files changed, 11 insertions(+)\n>\n> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> index 45133066e412..9cdcdb8bb414 100644\n> --- a/Documentation/pretty-formats.txt\n> +++ b/Documentation/pretty-formats.txt\n> @@ -190,6 +190,7 @@ The placeholders are:\n>  '%ai':: author date, ISO 8601-like format\n>  '%aI':: author date, strict ISO 8601 format\n>  '%as':: author date, short format (`YYYY-MM-DD`)\n> +'%ah':: author date, human style\n\nThere's no sorting here, so this place (at the bottom of the author-date\nplaceholders) seems just as good as any.\n\n>  '%cn':: committer name\n>  '%cN':: committer name (respecting .mailmap, see\n>  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> @@ -206,6 +207,7 @@ The placeholders are:\n>  '%ci':: committer date, ISO 8601-like format\n>  '%cI':: committer date, strict ISO 8601 format\n>  '%cs':: committer date, short format (`YYYY-MM-DD`)\n> +'%ch':: committer date, human style\n\nLikewise. The rest all looks good to me, too.\n\n  Reviewed-by: Taylor Blau <me@ttaylorr.com>\n\nThanks,\nTaylor\n"},{"id":"422819","messageId":"c6b43262-7ce4-b32e-3ff4-9edb66f2a20b@iee.email","threadId":"55546","inReplyTo":"pull.939.git.1619195245606.gitgitgadget@gmail.com","subject":"Re: [PATCH] [GSOC] pretty: provide human date format","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-04-23T21:10:52Z","receivedAt":"2021-04-23T21:11:35Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 23/04/2021 17:27, ZheNing Hu via GitGitGadget wrote:\n> From: ZheNing Hu <adlternative@gmail.com>\n>\n> Add the placeholders %ah and %ch to format author date and committer\n> date, like --date=human does, which provides more humanity date output.\n>\n> Signed-off-by: ZheNing Hu <adlternative@gmail.com>\n> ---\n>     [GSOC] pretty: provide human date format\n>     \n>     Reasons for making this patch: --date=human has no corresponding\n>     --pretty option.\n>     \n>     Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n>     effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n>     formats implement the corresponding option of --pretty, such as\n>     --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n>     \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/939\n>\n>  Documentation/pretty-formats.txt | 2 ++\n>  pretty.c                         | 3 +++\n>  t/t4205-log-pretty-formats.sh    | 6 ++++++\n>  3 files changed, 11 insertions(+)\n>\n> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> index 45133066e412..9cdcdb8bb414 100644\n> --- a/Documentation/pretty-formats.txt\n> +++ b/Documentation/pretty-formats.txt\n> @@ -190,6 +190,7 @@ The placeholders are:\n>  '%ai':: author date, ISO 8601-like format\n>  '%aI':: author date, strict ISO 8601 format\n>  '%as':: author date, short format (`YYYY-MM-DD`)\n> +'%ah':: author date, human style\n\nAn example may be useful. There's no other mention of human date style\nin the pretty-formats doc. Or a link to the definitive man page.\n\n>  '%cn':: committer name\n>  '%cN':: committer name (respecting .mailmap, see\n>  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> @@ -206,6 +207,7 @@ The placeholders are:\n>  '%ci':: committer date, ISO 8601-like format\n>  '%cI':: committer date, strict ISO 8601 format\n>  '%cs':: committer date, short format (`YYYY-MM-DD`)\n> +'%ch':: committer date, human style\nLikewise, an `(e.g. ????)` to unconfuse readers.\n>  '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n>  '%D':: ref names without the \" (\", \")\" wrapping.\n>  '%(describe[:options])':: human-readable name, like\n> diff --git a/pretty.c b/pretty.c\n> index e5b33ba034bd..b1ecd039cef2 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n>  \tcase 'I':\t/* date, ISO 8601 strict */\n>  \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n>  \t\treturn placeholder_len;\n> +\tcase 'h':\t/* date, human */\n> +\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n> +\t\treturn placeholder_len;\n>  \tcase 's':\n>  \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n>  \t\treturn placeholder_len;\n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index cabdf7d57a00..d4d75b0b350e 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n> @@ -539,6 +539,12 @@ test_expect_success 'short date' '\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success 'human date' '\n> +\tgit log --format=%ad%n%cd --date=human >expected &&\n> +\tgit log --format=%ah%n%ch >actual &&\n> +\ttest_cmp expected actual\n> +'\n> +\n>  # get new digests (with no abbreviations)\n>  test_expect_success 'set up log decoration tests' '\n>  \thead1=$(git rev-parse --verify HEAD~0) &&\n>\n> base-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\n--\nPhilip\n"},{"id":"422853","messageId":"CAOLTT8S9T7-WpgCJXZwt7rU5V72h+EMmRa+onkGjkRm53pEGDw@mail.gmail.com","threadId":"55546","inReplyTo":"YIMsOV/O2Ss+qaeK@nand.local","subject":"Re: [PATCH] [GSOC] pretty: provide human date format","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2021-04-24T13:26:28Z","receivedAt":"2021-04-24T13:26:45Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Taylor Blau <me@ttaylorr.com> 于2021年4月24日周六 上午4:21写道：\n>\n> Hi ZheNing,\n>\n> On Fri, Apr 23, 2021 at 04:27:25PM +0000, ZheNing Hu via GitGitGadget wrote:\n> > From: ZheNing Hu <adlternative@gmail.com>\n> >\n> > Add the placeholders %ah and %ch to format author date and committer\n> > date, like --date=human does, which provides more humanity date output.\n>\n> I don't see a reason why this shouldn't exist, and the patch that you\n> wrote below looks pretty good to me.\n>\n> To refresh my memory on if you had missed any spots, I followed\n> 0df621172d (pretty: provide short date format, 2019-11-19) as an\n> example. You did a fine job here, and I don't think this patch is\n> missing anything.\n>\n\nYes, I saw René Scharfe's (have --cc) patch and learned handle way from it.\n\n> > Signed-off-by: ZheNing Hu <adlternative@gmail.com>\n> > ---\n> >     [GSOC] pretty: provide human date format\n> >\n> >     Reasons for making this patch: --date=human has no corresponding\n> >     --pretty option.\n> >\n> >     Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n> >     effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n> >     formats implement the corresponding option of --pretty, such as\n> >     --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n> >     \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n>\n> Just to make sure I understand what you wrote: you're saying that the\n> pretty formats \"%ah\" and \"%ch\" that you propose here could be achieved\n> with --date=human and --pretty=\"%ad\". Makes sense, but I agree that your\n> point about --date=iso8601 having a built-in pretty atom makes the case\n> for having \"%ah\" and \"%ch\".\n>\n\nYes, I tried to explain that \"%(a|c)h\" makes sense.\n\n> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v1\n> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v1\n> > Pull-Request: https://github.com/gitgitgadget/git/pull/939\n> >\n> >  Documentation/pretty-formats.txt | 2 ++\n> >  pretty.c                         | 3 +++\n> >  t/t4205-log-pretty-formats.sh    | 6 ++++++\n> >  3 files changed, 11 insertions(+)\n> >\n> > diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> > index 45133066e412..9cdcdb8bb414 100644\n> > --- a/Documentation/pretty-formats.txt\n> > +++ b/Documentation/pretty-formats.txt\n> > @@ -190,6 +190,7 @@ The placeholders are:\n> >  '%ai':: author date, ISO 8601-like format\n> >  '%aI':: author date, strict ISO 8601 format\n> >  '%as':: author date, short format (`YYYY-MM-DD`)\n> > +'%ah':: author date, human style\n>\n> There's no sorting here, so this place (at the bottom of the author-date\n> placeholders) seems just as good as any.\n>\n> >  '%cn':: committer name\n> >  '%cN':: committer name (respecting .mailmap, see\n> >       linkgit:git-shortlog[1] or linkgit:git-blame[1])\n> > @@ -206,6 +207,7 @@ The placeholders are:\n> >  '%ci':: committer date, ISO 8601-like format\n> >  '%cI':: committer date, strict ISO 8601 format\n> >  '%cs':: committer date, short format (`YYYY-MM-DD`)\n> > +'%ch':: committer date, human style\n>\n> Likewise. The rest all looks good to me, too.\n>\n>   Reviewed-by: Taylor Blau <me@ttaylorr.com>\n>\n> Thanks,\n> Taylor\n\nThanks!\n--\nZheNing Hu\n"},{"id":"422854","messageId":"CAOLTT8SJW7+9Mxa7baTj+dSjkOyYQKNhWJbBdQAHKRp49j1yZA@mail.gmail.com","threadId":"55546","inReplyTo":"c6b43262-7ce4-b32e-3ff4-9edb66f2a20b@iee.email","subject":"Re: [PATCH] [GSOC] pretty: provide human date format","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2021-04-24T13:33:34Z","receivedAt":"2021-04-24T13:33:58Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Philip Oakley <philipoakley@iee.email> 于2021年4月24日周六 上午5:10写道：\n>\n> On 23/04/2021 17:27, ZheNing Hu via GitGitGadget wrote:\n> > From: ZheNing Hu <adlternative@gmail.com>\n> >\n> > Add the placeholders %ah and %ch to format author date and committer\n> > date, like --date=human does, which provides more humanity date output.\n> >\n> > Signed-off-by: ZheNing Hu <adlternative@gmail.com>\n> > ---\n> >     [GSOC] pretty: provide human date format\n> >\n> >     Reasons for making this patch: --date=human has no corresponding\n> >     --pretty option.\n> >\n> >     Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n> >     effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n> >     formats implement the corresponding option of --pretty, such as\n> >     --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n> >     \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n> >\n> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v1\n> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v1\n> > Pull-Request: https://github.com/gitgitgadget/git/pull/939\n> >\n> >  Documentation/pretty-formats.txt | 2 ++\n> >  pretty.c                         | 3 +++\n> >  t/t4205-log-pretty-formats.sh    | 6 ++++++\n> >  3 files changed, 11 insertions(+)\n> >\n> > diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> > index 45133066e412..9cdcdb8bb414 100644\n> > --- a/Documentation/pretty-formats.txt\n> > +++ b/Documentation/pretty-formats.txt\n> > @@ -190,6 +190,7 @@ The placeholders are:\n> >  '%ai':: author date, ISO 8601-like format\n> >  '%aI':: author date, strict ISO 8601 format\n> >  '%as':: author date, short format (`YYYY-MM-DD`)\n> > +'%ah':: author date, human style\n>\n> An example may be useful. There's no other mention of human date style\n> in the pretty-formats doc. Or a link to the definitive man page.\n>\n\nThanks for the suggestion. Note that the explanation here is relatively small,\nand human style has many different situations, so I may just go to link it to\n`rev-list-option.txt`, This is more convenient than showing multiple situations'\nexamples.\n\n> >  '%cn':: committer name\n> >  '%cN':: committer name (respecting .mailmap, see\n> >       linkgit:git-shortlog[1] or linkgit:git-blame[1])\n> > @@ -206,6 +207,7 @@ The placeholders are:\n> >  '%ci':: committer date, ISO 8601-like format\n> >  '%cI':: committer date, strict ISO 8601 format\n> >  '%cs':: committer date, short format (`YYYY-MM-DD`)\n> > +'%ch':: committer date, human style\n> Likewise, an `(e.g. ????)` to unconfuse readers.\n> >  '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n> >  '%D':: ref names without the \" (\", \")\" wrapping.\n> >  '%(describe[:options])':: human-readable name, like\n> > diff --git a/pretty.c b/pretty.c\n> > index e5b33ba034bd..b1ecd039cef2 100644\n> > --- a/pretty.c\n> > +++ b/pretty.c\n> > @@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n> >       case 'I':       /* date, ISO 8601 strict */\n> >               strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n> >               return placeholder_len;\n> > +     case 'h':       /* date, human */\n> > +             strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n> > +             return placeholder_len;\n> >       case 's':\n> >               strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n> >               return placeholder_len;\n> > diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> > index cabdf7d57a00..d4d75b0b350e 100755\n> > --- a/t/t4205-log-pretty-formats.sh\n> > +++ b/t/t4205-log-pretty-formats.sh\n> > @@ -539,6 +539,12 @@ test_expect_success 'short date' '\n> >       test_cmp expected actual\n> >  '\n> >\n> > +test_expect_success 'human date' '\n> > +     git log --format=%ad%n%cd --date=human >expected &&\n> > +     git log --format=%ah%n%ch >actual &&\n> > +     test_cmp expected actual\n> > +'\n> > +\n> >  # get new digests (with no abbreviations)\n> >  test_expect_success 'set up log decoration tests' '\n> >       head1=$(git rev-parse --verify HEAD~0) &&\n> >\n> > base-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\n> --\n> Philip\n\nThanks!\n--\nZheNing Hu\n"},{"id":"422856","messageId":"pull.939.v2.git.1619275340051.gitgitgadget@gmail.com","threadId":"55546","inReplyTo":"pull.939.git.1619195245606.gitgitgadget@gmail.com","subject":"[PATCH v2] [GSOC] pretty: provide human date format","fromName":"ZheNing Hu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-04-24T14:42:19Z","receivedAt":"2021-04-24T14:42:28Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"From: ZheNing Hu <adlternative@gmail.com>\n\nAdd the placeholders %ah and %ch to format author date and committer\ndate, like --date=human does, which provides more humanity date output.\n\nSigned-off-by: ZheNing Hu <adlternative@gmail.com>\n---\n    [GSOC] pretty: provide human date format\n    \n    Reasons for making this patch: --date=human has no corresponding\n    --pretty option.\n    \n    Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n    effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n    formats implement the corresponding option of --pretty, such as\n    --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n    \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n    \n    Change from v1: add %(a|c)h link to rev-list-options.txt.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/939\n\nRange-diff vs v1:\n\n 1:  ed8abd6179d1 ! 1:  1517708876b5 [GSOC] pretty: provide human date format\n     @@ Documentation/pretty-formats.txt: The placeholders are:\n       '%ai':: author date, ISO 8601-like format\n       '%aI':: author date, strict ISO 8601 format\n       '%as':: author date, short format (`YYYY-MM-DD`)\n     -+'%ah':: author date, human style\n     ++'%ah':: author date, human style (like the --date=human option of\n     ++\tlinkgit:rev-list-options.txt[1])\n       '%cn':: committer name\n       '%cN':: committer name (respecting .mailmap, see\n       \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n     @@ Documentation/pretty-formats.txt: The placeholders are:\n       '%ci':: committer date, ISO 8601-like format\n       '%cI':: committer date, strict ISO 8601 format\n       '%cs':: committer date, short format (`YYYY-MM-DD`)\n     -+'%ch':: committer date, human style\n     ++'%ch':: committer date, human style(like the --date=human option of\n     ++\tlinkgit:rev-list-options.txt[1])\n       '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n       '%D':: ref names without the \" (\", \")\" wrapping.\n       '%(describe[:options])':: human-readable name, like\n\n\n Documentation/pretty-formats.txt | 4 ++++\n pretty.c                         | 3 +++\n t/t4205-log-pretty-formats.sh    | 6 ++++++\n 3 files changed, 13 insertions(+)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 45133066e412..e37d5cbb6b16 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -190,6 +190,8 @@ The placeholders are:\n '%ai':: author date, ISO 8601-like format\n '%aI':: author date, strict ISO 8601 format\n '%as':: author date, short format (`YYYY-MM-DD`)\n+'%ah':: author date, human style (like the --date=human option of\n+\tlinkgit:rev-list-options.txt[1])\n '%cn':: committer name\n '%cN':: committer name (respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n@@ -206,6 +208,8 @@ The placeholders are:\n '%ci':: committer date, ISO 8601-like format\n '%cI':: committer date, strict ISO 8601 format\n '%cs':: committer date, short format (`YYYY-MM-DD`)\n+'%ch':: committer date, human style(like the --date=human option of\n+\tlinkgit:rev-list-options.txt[1])\n '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n '%D':: ref names without the \" (\", \")\" wrapping.\n '%(describe[:options])':: human-readable name, like\ndiff --git a/pretty.c b/pretty.c\nindex e5b33ba034bd..b1ecd039cef2 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tcase 'I':\t/* date, ISO 8601 strict */\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n \t\treturn placeholder_len;\n+\tcase 'h':\t/* date, human */\n+\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n+\t\treturn placeholder_len;\n \tcase 's':\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n \t\treturn placeholder_len;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex cabdf7d57a00..d4d75b0b350e 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -539,6 +539,12 @@ test_expect_success 'short date' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'human date' '\n+\tgit log --format=%ad%n%cd --date=human >expected &&\n+\tgit log --format=%ah%n%ch >actual &&\n+\ttest_cmp expected actual\n+'\n+\n # get new digests (with no abbreviations)\n test_expect_success 'set up log decoration tests' '\n \thead1=$(git rev-parse --verify HEAD~0) &&\n\nbase-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\n-- \ngitgitgadget\n"},{"id":"422861","messageId":"c0780b56-8852-d055-97ec-45ff93aa41de@iee.email","threadId":"55546","inReplyTo":"pull.939.v2.git.1619275340051.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] [GSOC] pretty: provide human date format","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-04-24T19:44:48Z","receivedAt":"2021-04-24T19:44:52Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"quoting nit..\nOn 24/04/2021 15:42, ZheNing Hu via GitGitGadget wrote:\n> From: ZheNing Hu <adlternative@gmail.com>\n>\n> Add the placeholders %ah and %ch to format author date and committer\n> date, like --date=human does, which provides more humanity date output.\n>\n> Signed-off-by: ZheNing Hu <adlternative@gmail.com>\n> ---\n>     [GSOC] pretty: provide human date format\n>     \n>     Reasons for making this patch: --date=human has no corresponding\n>     --pretty option.\n>     \n>     Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n>     effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n>     formats implement the corresponding option of --pretty, such as\n>     --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n>     \"--pretty=%(a|c)h\" seems to be a very reasonable thing.\n>     \n>     Change from v1: add %(a|c)h link to rev-list-options.txt.\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v2\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v2\n> Pull-Request: https://github.com/gitgitgadget/git/pull/939\n>\n> Range-diff vs v1:\n>\n>  1:  ed8abd6179d1 ! 1:  1517708876b5 [GSOC] pretty: provide human date format\n>      @@ Documentation/pretty-formats.txt: The placeholders are:\n>        '%ai':: author date, ISO 8601-like format\n>        '%aI':: author date, strict ISO 8601 format\n>        '%as':: author date, short format (`YYYY-MM-DD`)\n>      -+'%ah':: author date, human style\n>      ++'%ah':: author date, human style (like the --date=human option of\n>      ++\tlinkgit:rev-list-options.txt[1])\n>        '%cn':: committer name\n>        '%cN':: committer name (respecting .mailmap, see\n>        \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n>      @@ Documentation/pretty-formats.txt: The placeholders are:\n>        '%ci':: committer date, ISO 8601-like format\n>        '%cI':: committer date, strict ISO 8601 format\n>        '%cs':: committer date, short format (`YYYY-MM-DD`)\n>      -+'%ch':: committer date, human style\n>      ++'%ch':: committer date, human style(like the --date=human option of\n>      ++\tlinkgit:rev-list-options.txt[1])\n>        '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n>        '%D':: ref names without the \" (\", \")\" wrapping.\n>        '%(describe[:options])':: human-readable name, like\n>\n>\n>  Documentation/pretty-formats.txt | 4 ++++\n>  pretty.c                         | 3 +++\n>  t/t4205-log-pretty-formats.sh    | 6 ++++++\n>  3 files changed, 13 insertions(+)\n>\n> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> index 45133066e412..e37d5cbb6b16 100644\n> --- a/Documentation/pretty-formats.txt\n> +++ b/Documentation/pretty-formats.txt\n> @@ -190,6 +190,8 @@ The placeholders are:\n>  '%ai':: author date, ISO 8601-like format\n>  '%aI':: author date, strict ISO 8601 format\n>  '%as':: author date, short format (`YYYY-MM-DD`)\n> +'%ah':: author date, human style (like the --date=human option of\nshouldn't that option be quoted \" `--date=human` \" so as to match the\nformat in rev-list?\n> +\tlinkgit:rev-list-options.txt[1])\nAlso. Is this right? Shouldn't it just link to the dashed git- command's\nman page, rather than the file, i.e.\n linkgit:git-rev-list[1])\n>  '%cn':: committer name\n>  '%cN':: committer name (respecting .mailmap, see\n>  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> @@ -206,6 +208,8 @@ The placeholders are:\n>  '%ci':: committer date, ISO 8601-like format\n>  '%cI':: committer date, strict ISO 8601 format\n>  '%cs':: committer date, short format (`YYYY-MM-DD`)\n> +'%ch':: committer date, human style(like the --date=human option of\nlikewise, quote the option ? and resolve the linkgit: to the man page\n> +\tlinkgit:rev-list-options.txt[1])\n>  '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n>  '%D':: ref names without the \" (\", \")\" wrapping.\n>  '%(describe[:options])':: human-readable name, like\n> diff --git a/pretty.c b/pretty.c\n> index e5b33ba034bd..b1ecd039cef2 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n>  \tcase 'I':\t/* date, ISO 8601 strict */\n>  \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n>  \t\treturn placeholder_len;\n> +\tcase 'h':\t/* date, human */\n> +\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n> +\t\treturn placeholder_len;\n>  \tcase 's':\n>  \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n>  \t\treturn placeholder_len;\n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index cabdf7d57a00..d4d75b0b350e 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n> @@ -539,6 +539,12 @@ test_expect_success 'short date' '\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success 'human date' '\n> +\tgit log --format=%ad%n%cd --date=human >expected &&\n> +\tgit log --format=%ah%n%ch >actual &&\n> +\ttest_cmp expected actual\n> +'\n> +\n>  # get new digests (with no abbreviations)\n>  test_expect_success 'set up log decoration tests' '\n>  \thead1=$(git rev-parse --verify HEAD~0) &&\n>\n> base-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\nLooks good otherwise.\nPhilip\n"},{"id":"422872","messageId":"patch-1.2-4a90e4a141a-20210425T090506Z-avarab@gmail.com","threadId":"55546","inReplyTo":"cover-0.2-00000000000-20210425T090506Z-avarab@gmail.com","subject":"[PATCH 1/2] pretty tests: simplify %aI/%cI date format test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-04-25T09:11:32Z","receivedAt":"2021-04-25T09:11:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change a needlessly complex test for the %aI/%cI date\nformats (iso-strict) added in 466fb6742d7 (pretty: provide a strict\nISO 8601 date format, 2014-08-29) to instead use the same pattern used\nto test %as/%cs since 0df621172d8 (pretty: provide short date format,\n2019-11-19).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex cabdf7d57a0..0462115ac5c 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -527,8 +527,7 @@ test_expect_success 'strbuf_utf8_replace() not producing NUL' '\n \n # ISO strict date format\n test_expect_success 'ISO and ISO-strict date formats display the same values' '\n-\tgit log --format=%ai%n%ci |\n-\tsed -e \"s/ /T/; s/ //; s/..\\$/:&/\" >expected &&\n+\tgit log --format=%ad%n%cd --date=iso-strict >expected &&\n \tgit log --format=%aI%n%cI >actual &&\n \ttest_cmp expected actual\n '\n-- \n2.31.1.734.g8d26f61af32\n\n"},{"id":"422873","messageId":"cover-0.2-00000000000-20210425T090506Z-avarab@gmail.com","threadId":"55546","inReplyTo":"pull.939.v2.git.1619275340051.gitgitgadget@gmail.com","subject":"[PATCH 0/2] pretty tests: --date/format test improvements","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-04-25T09:11:31Z","receivedAt":"2021-04-25T09:11:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"A couple of trivial changes noticed when reviewing the \"pretty:\nprovide human date format\" series.\n\nÆvar Arnfjörð Bjarmason (2):\n  pretty tests: simplify %aI/%cI date format test\n  pretty tests: give --date/format tests a better description\n\n t/t4205-log-pretty-formats.sh | 9 ++++-----\n 1 file changed, 4 insertions(+), 5 deletions(-)\n\n-- \n2.31.1.734.g8d26f61af32\n\n"},{"id":"422874","messageId":"patch-2.2-6a17343b23b-20210425T090506Z-avarab@gmail.com","threadId":"55546","inReplyTo":"cover-0.2-00000000000-20210425T090506Z-avarab@gmail.com","subject":"[PATCH 2/2] pretty tests: give --date/format tests a better description","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-04-25T09:11:33Z","receivedAt":"2021-04-25T09:11:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the description for the --date/format equivalency tests added\nin 466fb6742d7 (pretty: provide a strict ISO 8601 date format,\n2014-08-29) and 0df621172d8 (pretty: provide short date format,\n2019-11-19) to be more meaningful.\n\nThis allows us to reword the comment added in the former commit to\nrefer to both tests, and any other future test, such as the in-flight\n--date=human format being proposed in [1].\n\n1. http://lore.kernel.org/git/pull.939.v2.git.1619275340051.gitgitgadget@gmail.com\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 0462115ac5c..bcb558ef4d7 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -525,14 +525,14 @@ test_expect_success 'strbuf_utf8_replace() not producing NUL' '\n \t! grep Q actual\n '\n \n-# ISO strict date format\n-test_expect_success 'ISO and ISO-strict date formats display the same values' '\n+# --date=[XXX] and corresponding %a[X] %c[X] format equivalency\n+test_expect_success '--date=iso-strict %ad%cd is the same as %aI%cI' '\n \tgit log --format=%ad%n%cd --date=iso-strict >expected &&\n \tgit log --format=%aI%n%cI >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'short date' '\n+test_expect_success '--date=short %ad%cd is the same as %as%cs' '\n \tgit log --format=%ad%n%cd --date=short >expected &&\n \tgit log --format=%as%n%cs >actual &&\n \ttest_cmp expected actual\n-- \n2.31.1.734.g8d26f61af32\n\n"},{"id":"422875","messageId":"CAOLTT8TPn6wF44ARPzq9p7Cnik2rz8DtA-oK1Zk33t49EquTJQ@mail.gmail.com","threadId":"55546","inReplyTo":"patch-2.2-6a17343b23b-20210425T090506Z-avarab@gmail.com","subject":"Re: [PATCH 2/2] pretty tests: give --date/format tests a better description","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2021-04-25T09:30:56Z","receivedAt":"2021-04-25T09:31:09Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Hi, Ævar Arnfjörð Bjarmason,\n\nÆvar Arnfjörð Bjarmason <avarab@gmail.com> 于2021年4月25日周日 下午5:11写道：\n>\n> Change the description for the --date/format equivalency tests added\n> in 466fb6742d7 (pretty: provide a strict ISO 8601 date format,\n> 2014-08-29) and 0df621172d8 (pretty: provide short date format,\n> 2019-11-19) to be more meaningful.\n>\n> This allows us to reword the comment added in the former commit to\n> refer to both tests, and any other future test, such as the in-flight\n> --date=human format being proposed in [1].\n>\n> 1. http://lore.kernel.org/git/pull.939.v2.git.1619275340051.gitgitgadget@gmail.com\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  t/t4205-log-pretty-formats.sh | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index 0462115ac5c..bcb558ef4d7 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n> @@ -525,14 +525,14 @@ test_expect_success 'strbuf_utf8_replace() not producing NUL' '\n>         ! grep Q actual\n>  '\n>\n> -# ISO strict date format\n> -test_expect_success 'ISO and ISO-strict date formats display the same values' '\n> +# --date=[XXX] and corresponding %a[X] %c[X] format equivalency\n> +test_expect_success '--date=iso-strict %ad%cd is the same as %aI%cI' '\n>         git log --format=%ad%n%cd --date=iso-strict >expected &&\n>         git log --format=%aI%n%cI >actual &&\n>         test_cmp expected actual\n>  '\n>\n> -test_expect_success 'short date' '\n> +test_expect_success '--date=short %ad%cd is the same as %as%cs' '\n>         git log --format=%ad%n%cd --date=short >expected &&\n>         git log --format=%as%n%cs >actual &&\n>         test_cmp expected actual\n> --\n> 2.31.1.734.g8d26f61af32\n>\n\nNotice that you modified the title of the test\n`short date`--->  `--date=short %ad%cd is the same as %as%cs`,\nthen the `human date` patch I am working should also do the similar\nthings as you do here?\n\n--\nZheNing Hu\n"},{"id":"422876","messageId":"pull.939.v3.git.1619347306291.gitgitgadget@gmail.com","threadId":"55546","inReplyTo":"pull.939.v2.git.1619275340051.gitgitgadget@gmail.com","subject":"[PATCH v3] [GSOC] pretty: provide human date format","fromName":"ZheNing Hu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-04-25T10:41:45Z","receivedAt":"2021-04-25T10:41:50Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"From: ZheNing Hu <adlternative@gmail.com>\n\nAdd the placeholders %ah and %ch to format author date and committer\ndate, like --date=human does, which provides more humanity date output.\n\nSigned-off-by: ZheNing Hu <adlternative@gmail.com>\n---\n    [GSOC] pretty: provide human date format\n    \n    Reasons for making this patch: --date=human has no corresponding\n    --pretty option.\n    \n    Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n    effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n    formats implement the corresponding option of --pretty, such as\n    --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n    --pretty=%(a|c)h seems to be a very reasonable thing.\n    \n    Change from v2: change %(a|c)h link to git-rev-list and change to more\n    suitable test title.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/939\n\nRange-diff vs v2:\n\n 1:  1517708876b5 ! 1:  67c57d8f4a17 [GSOC] pretty: provide human date format\n     @@ Documentation/pretty-formats.txt: The placeholders are:\n       '%ai':: author date, ISO 8601-like format\n       '%aI':: author date, strict ISO 8601 format\n       '%as':: author date, short format (`YYYY-MM-DD`)\n     -+'%ah':: author date, human style (like the --date=human option of\n     -+\tlinkgit:rev-list-options.txt[1])\n     ++'%ah':: author date, human style (like the `--date=human` option of\n     ++\tlinkgit:git-rev-list[1])\n       '%cn':: committer name\n       '%cN':: committer name (respecting .mailmap, see\n       \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n     @@ Documentation/pretty-formats.txt: The placeholders are:\n       '%ci':: committer date, ISO 8601-like format\n       '%cI':: committer date, strict ISO 8601 format\n       '%cs':: committer date, short format (`YYYY-MM-DD`)\n     -+'%ch':: committer date, human style(like the --date=human option of\n     -+\tlinkgit:rev-list-options.txt[1])\n     ++'%ch':: committer date, human style(like the `--date=human` option of\n     ++\tlinkgit:git-rev-list[1])\n       '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n       '%D':: ref names without the \" (\", \")\" wrapping.\n       '%(describe[:options])':: human-readable name, like\n     @@ t/t4205-log-pretty-formats.sh: test_expect_success 'short date' '\n       \ttest_cmp expected actual\n       '\n       \n     -+test_expect_success 'human date' '\n     ++test_expect_success '--date=human %ad%cd is the same as %ah%ch' '\n      +\tgit log --format=%ad%n%cd --date=human >expected &&\n      +\tgit log --format=%ah%n%ch >actual &&\n      +\ttest_cmp expected actual\n\n\n Documentation/pretty-formats.txt | 4 ++++\n pretty.c                         | 3 +++\n t/t4205-log-pretty-formats.sh    | 6 ++++++\n 3 files changed, 13 insertions(+)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 45133066e412..cd697f508c53 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -190,6 +190,8 @@ The placeholders are:\n '%ai':: author date, ISO 8601-like format\n '%aI':: author date, strict ISO 8601 format\n '%as':: author date, short format (`YYYY-MM-DD`)\n+'%ah':: author date, human style (like the `--date=human` option of\n+\tlinkgit:git-rev-list[1])\n '%cn':: committer name\n '%cN':: committer name (respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n@@ -206,6 +208,8 @@ The placeholders are:\n '%ci':: committer date, ISO 8601-like format\n '%cI':: committer date, strict ISO 8601 format\n '%cs':: committer date, short format (`YYYY-MM-DD`)\n+'%ch':: committer date, human style(like the `--date=human` option of\n+\tlinkgit:git-rev-list[1])\n '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n '%D':: ref names without the \" (\", \")\" wrapping.\n '%(describe[:options])':: human-readable name, like\ndiff --git a/pretty.c b/pretty.c\nindex e5b33ba034bd..b1ecd039cef2 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tcase 'I':\t/* date, ISO 8601 strict */\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n \t\treturn placeholder_len;\n+\tcase 'h':\t/* date, human */\n+\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n+\t\treturn placeholder_len;\n \tcase 's':\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n \t\treturn placeholder_len;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex cabdf7d57a00..10d511ba7307 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -539,6 +539,12 @@ test_expect_success 'short date' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--date=human %ad%cd is the same as %ah%ch' '\n+\tgit log --format=%ad%n%cd --date=human >expected &&\n+\tgit log --format=%ah%n%ch >actual &&\n+\ttest_cmp expected actual\n+'\n+\n # get new digests (with no abbreviations)\n test_expect_success 'set up log decoration tests' '\n \thead1=$(git rev-parse --verify HEAD~0) &&\n\nbase-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\n-- \ngitgitgadget\n"},{"id":"423044","messageId":"803b9a49-6d27-2792-faa2-d37886cb2151@drbeat.li","threadId":"55546","inReplyTo":"patch-1.2-4a90e4a141a-20210425T090506Z-avarab@gmail.com","subject":"Re: [PATCH 1/2] pretty tests: simplify %aI/%cI date format test","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2021-04-26T21:22:29Z","receivedAt":"2021-04-26T21:30:18Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 25.04.21 11:11, Ævar Arnfjörð Bjarmason wrote:\n> Change a needlessly complex test for the %aI/%cI date\n> formats (iso-strict) added in 466fb6742d7 (pretty: provide a strict\n> ISO 8601 date format, 2014-08-29) to instead use the same pattern used\n> to test %as/%cs since 0df621172d8 (pretty: provide short date format,\n> 2019-11-19).\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  t/t4205-log-pretty-formats.sh | 3 +--\n>  1 file changed, 1 insertion(+), 2 deletions(-)\n> \n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index cabdf7d57a0..0462115ac5c 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n> @@ -527,8 +527,7 @@ test_expect_success 'strbuf_utf8_replace() not producing NUL' '\n>  \n>  # ISO strict date format\n>  test_expect_success 'ISO and ISO-strict date formats display the same values' '\n> -\tgit log --format=%ai%n%ci |\n> -\tsed -e \"s/ /T/; s/ //; s/..\\$/:&/\" >expected &&\n> +\tgit log --format=%ad%n%cd --date=iso-strict >expected &&\n>  \tgit log --format=%aI%n%cI >actual &&\n>  \ttest_cmp expected actual\n>  '\n\nLGTM.\n\nI wonder if these format shortcut tests that now look so regular should\nbe put into a loop with a few suitable loop parameters?\n\nCheers, Beat\n"},{"id":"423060","messageId":"xmqqtunsdx1f.fsf@gitster.g","threadId":"55546","inReplyTo":"patch-1.2-4a90e4a141a-20210425T090506Z-avarab@gmail.com","subject":"Re: [PATCH 1/2] pretty tests: simplify %aI/%cI date format test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-27T07:08:44Z","receivedAt":"2021-04-27T07:08:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n>  # ISO strict date format\n>  test_expect_success 'ISO and ISO-strict date formats display the same values' '\n> -\tgit log --format=%ai%n%ci |\n> -\tsed -e \"s/ /T/; s/ //; s/..\\$/:&/\" >expected &&\n> +\tgit log --format=%ad%n%cd --date=iso-strict >expected &&\n>  \tgit log --format=%aI%n%cI >actual &&\n\nWhile these two must show the same output, I wonder how much value\nwe are getting out of them.  Don't they end up exercising pretty\nmuch the same codepath?\n\nNot that I think the original is any better at all, though ;-)\n\n>  \ttest_cmp expected actual\n>  '\n"},{"id":"423502","messageId":"pull.939.v4.git.1620056221874.gitgitgadget@gmail.com","threadId":"55546","inReplyTo":"pull.939.v3.git.1619347306291.gitgitgadget@gmail.com","subject":"[PATCH v4] [GSOC] pretty: provide human date format","fromName":"ZheNing Hu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-05-03T15:37:01Z","receivedAt":"2021-05-03T15:37:08Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"From: ZheNing Hu <adlternative@gmail.com>\n\nAdd the placeholders %ah and %ch to format author date and committer\ndate, like --date=human does, which provides more humanity date output.\n\nSigned-off-by: ZheNing Hu <adlternative@gmail.com>\n---\n    [GSOC] pretty: provide human date format\n    \n    Reasons for making this patch: --date=human has no corresponding\n    --pretty option.\n    \n    Although --date=human with --pretty=\"%(a|c)d\" can achieve the same\n    effect with --pretty=\"%(a|c)h\", but it can be noticed that most time\n    formats implement the corresponding option of --pretty, such as\n    --date=iso8601 can be replaced by --pretty=%(a|c)i, so add\n    --pretty=%(a|c)h seems to be a very reasonable thing.\n    \n    Change from v3: Fix format errors.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-939%2Fadlternative%2Fpretty_human-v4\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-939/adlternative/pretty_human-v4\nPull-Request: https://github.com/gitgitgadget/git/pull/939\n\nRange-diff vs v3:\n\n 1:  67c57d8f4a17 ! 1:  8e5ae0d9a01e [GSOC] pretty: provide human date format\n     @@ Documentation/pretty-formats.txt: The placeholders are:\n       '%ci':: committer date, ISO 8601-like format\n       '%cI':: committer date, strict ISO 8601 format\n       '%cs':: committer date, short format (`YYYY-MM-DD`)\n     -+'%ch':: committer date, human style(like the `--date=human` option of\n     ++'%ch':: committer date, human style (like the `--date=human` option of\n      +\tlinkgit:git-rev-list[1])\n       '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n       '%D':: ref names without the \" (\", \")\" wrapping.\n\n\n Documentation/pretty-formats.txt | 4 ++++\n pretty.c                         | 3 +++\n t/t4205-log-pretty-formats.sh    | 6 ++++++\n 3 files changed, 13 insertions(+)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 45133066e412..58bb2795284d 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -190,6 +190,8 @@ The placeholders are:\n '%ai':: author date, ISO 8601-like format\n '%aI':: author date, strict ISO 8601 format\n '%as':: author date, short format (`YYYY-MM-DD`)\n+'%ah':: author date, human style (like the `--date=human` option of\n+\tlinkgit:git-rev-list[1])\n '%cn':: committer name\n '%cN':: committer name (respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n@@ -206,6 +208,8 @@ The placeholders are:\n '%ci':: committer date, ISO 8601-like format\n '%cI':: committer date, strict ISO 8601 format\n '%cs':: committer date, short format (`YYYY-MM-DD`)\n+'%ch':: committer date, human style (like the `--date=human` option of\n+\tlinkgit:git-rev-list[1])\n '%d':: ref names, like the --decorate option of linkgit:git-log[1]\n '%D':: ref names without the \" (\", \")\" wrapping.\n '%(describe[:options])':: human-readable name, like\ndiff --git a/pretty.c b/pretty.c\nindex e5b33ba034bd..b1ecd039cef2 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -745,6 +745,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tcase 'I':\t/* date, ISO 8601 strict */\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(ISO8601_STRICT)));\n \t\treturn placeholder_len;\n+\tcase 'h':\t/* date, human */\n+\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(HUMAN)));\n+\t\treturn placeholder_len;\n \tcase 's':\n \t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n \t\treturn placeholder_len;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex cabdf7d57a00..10d511ba7307 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -539,6 +539,12 @@ test_expect_success 'short date' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--date=human %ad%cd is the same as %ah%ch' '\n+\tgit log --format=%ad%n%cd --date=human >expected &&\n+\tgit log --format=%ah%n%ch >actual &&\n+\ttest_cmp expected actual\n+'\n+\n # get new digests (with no abbreviations)\n test_expect_success 'set up log decoration tests' '\n \thead1=$(git rev-parse --verify HEAD~0) &&\n\nbase-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a\n-- \ngitgitgadget\n"}]}