{"thread":{"id":"44186","subject":"[PATCH/RFC] git log --oneline alternative with dates, times and initials","startedAt":"2016-09-29T05:35:03Z","lastAt":"2016-10-01T09:18:35Z","messageCount":20,"participants":["Kyle J. McKay","Jeff King","Junio C Hamano","Jacob Keller","SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"302861","messageId":"git-log-times@mackyle-at-gmail-com","threadId":"44186","inReplyTo":null,"subject":"[PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Kyle J. McKay","fromEmail":"mackyle@gmail.com","sentAt":"2016-09-29T05:34:51Z","receivedAt":"2016-09-29T05:35:03Z","isPatch":true,"sender":{"key":"mackyle@gmail.com","avatar":"https://avatars.githubusercontent.com/u/813346?v=4"},"body":"Simple example output from the Git repository:\n\ngit log-times --graph --date-order --decorate --no-merges -n 5 v2.5.3\n\n    === 2015-09-17 ===\n  * ee6ad5f4 12:16 jch (tag: v2.5.3) Git 2.5.3\n    === 2015-09-09 ===\n  * b9d66899 14:22 js  am --skip/--abort: merge HEAD/ORIG_HEAD tree into index\n  |   === 2015-09-04 ===\n  | * 27ea6f85 10:46 jch (tag: v2.5.2) Git 2.5.2\n  * 74b67638 10:36 jch (tag: v2.4.9) Git 2.4.9\n                       ..........\n  * ecad27cf 10:32 jch (tag: v2.3.9) Git 2.3.9\n\nI have been wanting a compact one line output format that included dates,\ntimes and initials for some time that is compatible with --graph, clearly\nshows root commits and eliminates confusion over whether or not two adjacent\nlines in the output are related as parent/child (the --show-linear-break\noption does not work with --graph).\n\nThe git-log-times utility is the result.  Except for --notes, --pretty and\n--format options (which would make the output a non-oneline format) any\nother `git log` option may be used (including things like --cherry-mark,\n--patch, --raw, --stat, --summary, --show-linear-break etc.),\n\nThere are a few new options specific to git-log-times which are described\nin the README and the `git-log-times -h` output that can be used to alter\nthe dates, times and/or initials displayed.\n\nThe patch below adds a contrib/git-log-times directory containing the\nexecutable (git-log-times) and the README.\n\n--Kyle\n\nP.S. git am complains about 26 lines with whitespace errors.  They are\n     not whitespace errors.  The README is in markdown format and they\n     are explicit line break instructions to markdown (2 trailing blanks).\n     Removing them would corrupt the markdown output.\n\nP.P.S A picture is worth a thousand words, so the formatted help text,\n      and several images of actual git-log-times output are available at\n      https://gist.github.com/mackyle/4c33e4802a8269b3f200f2c00352ce6a\n\n-- 8< --\nSubject: [PATCH] contrib/git-log-times: alternative git log --oneline utility\n\nThe git-log-times utility provides an alternative interface to using\ngit log --oneline that includes dates, times and author initials.\n\nAdditionally root commits are marked for easy identification and\nwhen using --graph mode breaks are inserted when necessary to prevent\ntwo adjacent output lines from being misconstrued as having a parent\nchild relationship when they actually do not.\n\nOther than --notes, --pretty and --format options which are not\nallowed (because that would no longer be a one line format) all git\nlog options are available for use.\n\nOutput will be colorized using the same rules used for git log\noutput.\n\nThe three extra items in the output (dates, times and initials) use\n'color.log-times.date', 'color.log-times.time' and\n'color.log-times.initials' to change their default color.\n\nOther options specific to git-log-times may be shown by using the\n-h option (i.e. `git-log-times -h`).\n\nOne or more default options which behave as though they are the\nfirst option argument(s) on the command line may be set by assigning\nthem to the 'log-times.defaults' config value as space-separated\noptions each including its leading '-' or '--'.\n\nSigned-off-by: Kyle J. McKay <mackyle@gmail.com>\n---\n contrib/git-log-times/README        | 256 ++++++++++++++++++++\n contrib/git-log-times/git-log-times | 464 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 720 insertions(+)\n create mode 100644 contrib/git-log-times/README\n create mode 100755 contrib/git-log-times/git-log-times\n\ndiff --git a/contrib/git-log-times/README b/contrib/git-log-times/README\nnew file mode 100644\nindex 00000000..65f1d2c5\n--- /dev/null\n+++ b/contrib/git-log-times/README\n@@ -0,0 +1,256 @@\n+git-log-times\n+=============\n+\n+An alterative to `git log --oneline` that includes dates, times and\n+author initials in a compact one line output format.\n+\n+The `--notes`, `--pretty` and `--format` options are not allowed but any\n+other `git log` options should work fine including `--graph`.\n+\n+In both `--graph` and non `--graph` modes:\n+\n+   * Root commits are identified by `_` on either side of the hash\n+\n+When `--graph` mode is enabled, the graph output is enhanced as follows:\n+\n+   * Breaks are inserted when necessary to avoid parent/child ambiguity\n+\n+\n+Installation\n+------------\n+\n+Put the `git-log-times` executable file in one of the directories\n+included in the `PATH` environment variable.\n+\n+Optionally set a global alias to save typing such as `lo` like so:\n+\n+    git config --global alias.lo log-times\n+\n+Optionally set global default options such as `--two-initials` and\n+`--abbrev=8` like so:\n+\n+    git config --global log-times.defaults \"--two-initials --abbrev=8\"\n+\n+\n+Dates & Times\n+-------------\n+\n+Dates and times are shown in the local timezone.  Set the TZ variable\n+before running `git log-times` (e.g. `TZ=UTC git log-times` to show\n+dates and times in UTC) or use the `--time-zone=` option (e.g.\n+`git log-times --time-zone=UTC`) to change that.\n+\n+Dates are shown on a date line all by themselves like so:\n+\n+    === 2015-11-13 ===\n+\n+The date line indicates that the times on all the following lines\n+(regardless of whether or not `--reverse` is being used) up until\n+the next date line take place on the indicated date.  For example\n+this output:\n+\n+    === 2015-09-28 ===\n+    be08dee9 13:18 jc (tag: v2.6.0) Git 2.6\n+    === 2015-09-21 ===\n+    8d530c4d 13:26 jc (tag: v2.6.0-rc3) Git 2.6-rc3\n+    904f6e7c 10:51 bn send-email: fix uninitialized var warning for $\n+    === 2015-09-20 ===\n+    18a21c19 09:49 ps l10n: de.po: better language for one string\n+    2e0f3663 09:49 rt l10n: de.po: translate 2 messages\n+    5fc31c1f 09:44 tq l10n: Update and review Vietnamese translation\n+\n+shows one commit on 2015-09-28, two commits on 2015-09-21 and three\n+commits on 2015-09-20.\n+\n+Note that a date line may appear more than once for the same date\n+(this is especially common when using `--graph` with its defualt\n+`--topo-order`).\n+\n+The purpose of a date line is to indicate what date has been elided\n+from the following lines, nothing more.\n+\n+\n+Examples\n+--------\n+\n+For example, running `git log-times --decorate --graph -n 17 v2.6.1`\n+on the Git repository produces this output (which will be colorized\n+on the terminal if color is enabled):\n+\n+      === 2015-09-28 ===\n+    * 22f698cb 19:19 jch (tag: v2.6.1) Git 2.6.1\n+    *   3adc4ec7 19:16 jch Sync with v2.5.4\n+    |\\\n+    | * 24358560 15:34 jch (tag: v2.5.4) Git 2.5.4\n+    | *   11a458be 15:33 jch Sync with 2.4.10\n+    | |\\\n+    | | * a2558fb8 15:30 jch (tag: v2.4.10) Git 2.4.10\n+    | | *   6343e2f6 15:28 jch Sync with 2.3.10\n+    | | |\\\n+    | | | * 18b58f70 15:26 jch (tag: v2.3.10) Git 2.3.10\n+    | | | *   92cdfd21 14:59 jch Merge branch 'jk/xdiff-memory-limits\n+    | | | |\\\n+    | | | | * 83c4d380 14:58 jk  merge-file: enforce MAX_XDIFF_SIZE o\n+    | | | | * dcd1742e 14:57 jk  xdiff: reject files larger than ~1GB\n+    | | | | * 3efb9880 14:57 jk  react to errors in xdi_diff\n+    | | | * |   f2df3104 14:46 jch Merge branch 'jk/transfer-limit-re\n+    | | | |\\ \\\n+    | | | | | | === 2015-09-25 ===\n+    | | | | * | b2581164 15:32 bb  http: limit redirection depth\n+    | | | | * | f4113cac 15:30 bb  http: limit redirection to protoco\n+    | | | | * | 5088d3b3 15:28 jk  transport: refactor protocol white\n+    | | | | | |   === 2015-09-28 ===\n+    | | | * | |   df37727a 14:33 jch Merge branch 'jk/transfer-limit-\n+    | | | |\\ \\ \\\n+    | | | | |/ /\n+    | | | | | /\n+    | | | | |/\n+    | | | |/|\n+    | | | | | === 2015-09-23 ===\n+    | | | | * 33cfccbb 11:35 jk  submodule: allow only certain protoc\n+\n+The output will be colorized according to the same settings used to enable/\n+disable color for git log output.\n+\n+Additionally, the color of the three new items (dates, times and\n+initials) can be controlled with the `color.log-times.date`,\n+`color.log-times.time` and `color.log-times.initials` config options.\n+\n+Running `git log-times --graph --max-parents=0` on the Git repository gives:\n+\n+      === 2009-04-24 ===\n+    *_0ca71b37_11:13 ap  basic options parsing and whatnot.\n+      === 2007-01-30 ===\n+    *_16d6b8ab_15:16 sh  Initial import of a python script to import ch\n+      === 2006-11-06 ===\n+    *_cb07fc2a_11:20 sop git-gui: Initial revision.\n+      === 2005-08-07 ===\n+    *_161332a5_10:49 ks  first working version\n+      === 2005-04-11 ===\n+    *_2744b234_23:46 lt  Start of early patch applicator tools for git.\n+      === 2005-05-08 ===\n+    *_1db95b00_21:08 pm  Add initial version of gitk to the CVS reposit\n+      === 2005-04-07 ===\n+    *_e83c5163_15:13 lt  Initial revision of \"git\", the information man\n+\n+Notice the `_` on either side of the hash identifying those commits\n+as root commits.  The `_` will only appear on the left side of the\n+hash if the selected output format would have normally included a\n+space there.  In `--graph` mode, all the spaces between the commit mark\n+(e.g. `*`) and the hash are turned into `_`.\n+\n+Running `git log-times --decorate --graph --no-merges -n 13 v2.6.1`\n+on the Git repository results in this output:\n+\n+      === 2015-09-28 ===\n+    * 22f698cb 19:19 jch (tag: v2.6.1) Git 2.6.1\n+                         ..........\n+    * 24358560 15:34 jch (tag: v2.5.4) Git 2.5.4\n+                         ..........\n+    * a2558fb8 15:30 jch (tag: v2.4.10) Git 2.4.10\n+                         ..........\n+    * 18b58f70 15:26 jch (tag: v2.3.10) Git 2.3.10\n+                         ..........\n+    * 83c4d380 14:58 jk  merge-file: enforce MAX_XDIFF_SIZE on incomi\n+    * dcd1742e 14:57 jk  xdiff: reject files larger than ~1GB\n+    * 3efb9880 14:57 jk  react to errors in xdi_diff\n+    |   === 2015-09-25 ===\n+    | * b2581164 15:32 bb  http: limit redirection depth\n+    | * f4113cac 15:30 bb  http: limit redirection to protocol-whitel\n+    | * 5088d3b3 15:28 jk  transport: refactor protocol whitelist cod\n+    | | === 2015-09-23 ===\n+    | * 33cfccbb 11:35 jk  submodule: allow only certain protocols fo\n+    | * a5adaced 11:35 jk  transport: add a protocol-whitelist enviro\n+    |/\n+    |   === 2015-09-28 ===\n+    | * be08dee9 13:18 jch (tag: v2.6.0) Git 2.6\n+\n+Notice how four linear breaks (`..........`) were automatically\n+inserted to avoid parent child relationship confusion.\n+\n+In non `--graph` mode, linear breaks are NOT automatically inserted.\n+They must be requested with the usual `--show-linear-break` option.\n+\n+\n+Options\n+-------\n+\n+In addition to allowing all the normal `git log` options except for\n+`--notes`, `--format` and `--pretty` (`--oneline` is allowed and\n+silently ignored), the following additional options may be utilized:\n+\n+   * `--seconds`  \n+     include seconds in the time (i.e. HH:MM:SS instead of just HH:MM)\n+\n+   * `--minutes`  \n+     include minutes but not seconds in the time (i.e. HH:MM not HH:MM:SS)  \n+     This is the default\n+\n+   * `--no-times`  \n+     omit the time field entirely\n+\n+   * `--two-initials`  \n+     only show at most two initials instead of the usual three  \n+     This is the default if `--initials=author,committer` or\n+     `--initials=committer,author` is used.\n+\n+   * `--three-initials`  \n+     show at most three initials  \n+     This is the default unless `--initials=author,committer` or\n+     `--initials=committer,author` is used.\n+\n+   * `--no-initials`  \n+     omit the initials field entirely\n+\n+   * `--commit-message`  \n+     when using `--walk-reflogs` show commit message not reflog message\n+\n+   * `--author-date`  \n+     force use of author dates and times  \n+     The default is to use committer dates and times unless\n+     `--author-date-order` is in effect.  This option forces author\n+     dates and times to always be used and overrides `--committer-date`.\n+\n+   * `--committer-date`  \n+     force use of committer dates and times  \n+     The default is to use committer dates and times if `--date-order` or\n+     `--topo-order` is in effect or `--author-date-order` is NOT in effect.\n+     This option forces committer dates and times to always be used and\n+     overrides a previous `--author-date` option.\n+\n+   * `--initials=author`  \n+     show author initials  \n+     This is the default behavior\n+\n+   * `--initials=committer`  \n+     show committer initials instead of author initials\n+\n+   * `--initials=author,committer`  \n+     show author and commiter initials separated by a `/`  \n+     This changes the initials width default from three to two.\n+\n+   * `--initials=committer,author`  \n+     show commiter and author initials separated by a `/`  \n+     This changes the initials width default from three to two.\n+\n+   * `--time-zone=zone`  \n+     set the TZ environment variable to `zone`  \n+     This is an alterative to setting TZ before running `git log-times`\n+     and will affect the time zone dates and times are displayed in.\n+\n+   * `--weekday`  \n+     show the weekday with the date\n+\n+   * `--no-weekday`  \n+     do not show the weekday with the date  \n+     This is the default behavior\n+\n+In addition to the above options, color output is controlled as normal\n+for `git log` with the addition of `color.log-times.date`,\n+`color.log-times.time` and `color.log-times.initials` config options to alter\n+the default colors for dates, times and initials respectively.\n+\n+Furthermore, default options may be set in the `log-times.defaults`\n+config value and they will be treated as though they appeared at\n+the very beginning of the `git log-times` command line option list\n+(e.g. `git config log-times.defaults \"--abbrev=8 --seconds\"`).\ndiff --git a/contrib/git-log-times/git-log-times b/contrib/git-log-times/git-log-times\nnew file mode 100755\nindex 00000000..d0e5face\n--- /dev/null\n+++ b/contrib/git-log-times/git-log-times\n@@ -0,0 +1,464 @@\n+#!/usr/bin/env perl\n+\n+# git-log-times.pl -- git log --oneline variation with dates, times and initials\n+# Copyright (C) 2015,2016 Kyle J. McKay <mackyle@gmail.com>.  All rights reserved.\n+\n+# License GPL v2\n+\n+# Version 1.0\n+\n+use 5.008;\n+use strict;\n+use warnings;\n+use File::Basename qw(basename);\n+use POSIX qw(strftime _exit);\n+use Encode;\n+\n+my $USAGE = <<'USAGE';\n+usage: git%slog-times [<options>] [<revision-range>] [[--] <path>...]\n+\n+    -h                    Show this help\n+    --seconds             Use HH:MM:SS instead of just the default HH:MM\n+    --minutes             Use just HH:MM (default) for times not HH:MM:SS\n+    --no-times            Omit the time field entirely\n+    --two-initials        Use maximum of two initials instead of default three\n+    --three-initials      Use maximum of three initials (default)\n+    --no-initials         Omit the initials field entirely\n+    --commit-message      Show the commit message when using --walk-reflogs\n+    --author-date         Use author dates and times\n+    --committer-date      Use committer dates and times (default)\n+    --initials=author     Use author initials (default)\n+    --initials=committer  Use committer initials\n+    --intiials=author,committer\n+                          Use author/committer initials and --two-initials\n+    --intiials=committer,author\n+                          Use committer/author initials and --two-initials\n+    --time-zone=<zone>    Set TZ environment variable to <zone>\n+    --weekday             Show the weekday with the date\n+    --no-weekday          Do not show the weekday with the date (default)\n+\n+    other log options     See `git help log` for more information\n+\n+Default colors for dates, times and initials may be changed by setting\n+`color.log-times.date`, `color.log-times.time` and/or\n+`color.log-times.initials` config values.  Dates and times are shown in the\n+local time zone if TZ is not set in the environment and the `--time-zone`\n+option has not been used.  Default options may be set in the\n+`log-times.defaults` config value and they will be treated as though they were\n+listed first in the command line options list (e.g.\n+`git config log-times.defaults \"--abbrev=8 --seconds\"`)\n+USAGE\n+\n+my $timeformat = \"%H:%M\";\n+\n+$SIG{PIPE} = sub {_exit 1};\n+\n+sub dodie {\n+\tmy $msg = join(\" \", @_);\n+\tchomp $msg;\n+\tdie basename($0).\": fatal: \".$msg.\"\\n\";\n+}\n+\n+my ($setusedecorate, $usedecorate);\n+sub use_decorate {\n+\treturn $usedecorate if $setusedecorate;\n+\tmy $do = qx(git config --get log.decorate 2>/dev/null) || \"0\";\n+\tchomp $do;\n+\treturn 0 if $do eq \"0\" || $do eq \"false\" || $do eq \"off\";\n+\treturn 0 if $do eq \"auto\" && ! -t STDOUT;\n+\treturn 1;\n+}\n+\n+my $iw;\n+sub get_initials {\n+\tmy $initials = shift;\n+\tmy $wasutf8 = utf8::decode($initials);\n+\t$initials = lc($initials).\" \";\n+\t$initials =~ s/[.]/ /g;\n+\t$initials =~ s/ iii? / /g;\n+\t$initials =~ s/ iv / /g;\n+\t$initials =~ s/ [js]r / /g;\n+\t$initials =~ s/[,;:'\\042+_-]//g;\n+\t$initials =~ s/\\([^(]*?\\)/ /g;\n+\t$initials =~ s/\\[[^[]*?\\]/ /g;\n+\t$initials =~ s/\\s+/ /g;\n+\t$initials =~ s/^ //g;\n+\treturn \"jc\" if $iw == 2 && $initials eq \"junio c hamano \";\n+\t$initials =~ s/([^ ])[^ ]* /$1/g;\n+\tif ($iw == 2) {\n+\t\t$initials =~ s/^(.).+(.)$/$1$2/;\n+\t} else {\n+\t\t$initials =~ s/^(..).+(.)$/$1$2/;\n+\t}\n+\tutf8::encode($initials) if $wasutf8;\n+\treturn $initials;\n+}\n+\n+sub get_nocolor_indent {\n+\tmy $indent = shift;\n+\t$indent =~ s/\\033[^m]*m//g;\n+\t$indent =~ s/\\s+$//;\n+\t$indent =~ s/-+\\.$//;\n+\treturn $indent;\n+}\n+\n+sub get_blank_graph_indent {\n+\tmy $indent = shift;\n+\tchomp $indent;\n+\t$indent =~ s/\\033[^m]*m//g;\n+\t$indent =~ s/^[\\s|]+//;\n+\treturn $indent;\n+}\n+\n+sub get_first_indent {\n+\tmy $indent = shift;\n+\t$indent =~ s/\\033[^m]*m//g;\n+\t$indent =~ s/./ /gs;\n+\treturn $indent;\n+}\n+\n+my $nobar;\n+my $barcolor;\n+my $resetcolor = \"\";\n+\n+sub get_bar_color {\n+\tmy ($prefix, $index) = @_;\n+\tmy $c = (split(m{[-=^<>*+o /|\\\\_]}, $prefix))[$index];\n+\t$c =~ s/\\Q$resetcolor\\E//g if $resetcolor;\n+\treturn $c;\n+}\n+\n+sub get_indent {\n+\tmy $indent = shift;\n+\tif ($nobar) {\n+\t\t$indent =~ tr/\\-=^<>*+o./         /;\n+\t} else {\n+\t\t$indent =~ s/[-=^<>*+o]/$barcolor ? $barcolor.\"|\".$resetcolor : \"|\"/e;\n+\t\t$indent =~ tr/\\-./  /;\n+\t}\n+\treturn $indent;\n+}\n+\n+sub get_prefix {\n+\tmy $indent = shift;\n+\t$indent =~ tr'\\/'||';\n+\treturn $indent;\n+}\n+\n+sub get_defaults {\n+\t# defaults are cumulative, but an empty setting resets\n+\tmy @defaults = ();\n+\tmy $opts = qx(git config --get-all log-times.defaults 2>/dev/null);\n+\tchomp($opts);\n+\tforeach (split(/\\r\\n|\\r|\\n/, $opts, -1)) {\n+\t\ts/^\\s+//; s/\\s+$//;\n+\t\tif ($_ eq \"\") {\n+\t\t\t@defaults = ();\n+\t\t\tnext;\n+\t\t}\n+\t\tpush(@defaults, $_);\n+\t}\n+\treturn split(\" \", join(\" \", @defaults));\n+}\n+\n+system(\"git rev-parse --git-dir >/dev/null\") == 0 or exit(1);\n+my ($usemark, $usegraph, $usereflog, $useboundary, $useleftright, $usecherry, $setusecolor, $usecolor, $usecad);\n+my @args = ();\n+my $lastwasgrep;\n+my $dateopt = \"%ct\";\n+my $usewkday;\n+my $reflogsubj = \"%gs\";\n+my $sawdashdash;\n+$iw = undef;\n+my $iw2 = \"\";\n+my ($committer, $author, $ivar, $ivar2);\n+$ivar = \\$author;\n+foreach my $arg (get_defaults(), @ARGV) {\n+\tmy $nextisgrep;\n+\tif ($sawdashdash || $lastwasgrep) {\n+\t\tpush(@args, $arg);\n+\t\t$lastwasgrep = $nextisgrep;\n+\t\tnext;\n+\t}\n+\tif ($arg eq \"-h\") {\n+\t\tmy $dash = \"-\";\n+\t\tmy $exec_path = qx(git --exec-path 2>/dev/null);\n+\t\tchomp $exec_path;\n+\t\t$dash = \" \" if $ENV{PATH} =~ /^\\Q$exec_path\\E:/;\n+\t\tprintf \"$USAGE\\n\", $dash;\n+\t\texit 0;\n+\t} elsif ($arg eq \"--oneline\") {\n+\t\t# silently ignore --oneline as we are always in a one line format\n+\t\tnext;\n+\t} elsif ($arg eq \"--seconds\") {\n+\t\t# extra option\n+\t\t$timeformat = \"%H:%M:%S\";\n+\t\tnext;\n+\t} elsif ($arg eq \"--minutes\") {\n+\t\t# extra option\n+\t\t$timeformat = \"%H:%M\";\n+\t\tnext;\n+\t} elsif ($arg eq \"--no-times\") {\n+\t\t# extra option\n+\t\t$timeformat = \"\";\n+\t\tnext;\n+\t} elsif ($arg eq \"--two-initials\") {\n+\t\t# extra option\n+\t\t$iw = 2;\n+\t\tnext;\n+\t} elsif ($arg eq \"--three-initials\") {\n+\t\t# extra option\n+\t\t$iw = 3;\n+\t\tnext;\n+\t} elsif ($arg eq \"--no-initials\") {\n+\t\t# extra option\n+\t\t$iw = 0;\n+\t\tnext;\n+\t} elsif ($arg eq \"--two-initials\") {\n+\t\t# extra option\n+\t\t$iw = 3;\n+\t\tnext;\n+\t} elsif ($arg eq \"--commit-message\") {\n+\t\t# extra option\n+\t\t$reflogsubj = \"%s\";\n+\t\tnext;\n+\t} elsif ($arg eq \"--author-date\") {\n+\t\t# extra option\n+\t\t$dateopt = \"%at\";\n+\t\t$usecad = 1;\n+\t\tnext;\n+\t} elsif ($arg eq \"--committer-date\") {\n+\t\t# extra option\n+\t\t$dateopt = \"%ct\";\n+\t\t$usecad = 1;\n+\t\tnext;\n+\t} elsif ($arg eq \"--weekday\") {\n+\t\t# extra option\n+\t\t$usewkday = 1;\n+\t\tnext;\n+\t} elsif ($arg eq \"--no-weekday\") {\n+\t\t# extra option\n+\t\t$usewkday = undef;\n+\t\tnext;\n+\t} elsif ($arg =~ /^--initials=/) {\n+\t\t# extra option\n+\t\t$arg =~ s/^--initials=//;\n+\t\tif ($arg eq \"author\") {\n+\t\t\t$ivar = \\$author;\n+\t\t\t$ivar2 = undef;\n+\t\t} elsif ($arg eq \"committer\") {\n+\t\t\t$ivar = \\$committer;\n+\t\t\t$ivar2 = undef;\n+\t\t} elsif ($arg eq \"committer,author\" || $arg eq \"committer/author\") {\n+\t\t\t$ivar = \\$committer;\n+\t\t\t$ivar2 = \\$author;\n+\t\t} elsif ($arg eq \"author,committer\" || $arg eq \"author/committer\") {\n+\t\t\t$ivar = \\$author;\n+\t\t\t$ivar2 = \\$committer;\n+\t\t} else {\n+\t\t\tdodie \"--initials= requires 'author', 'committer' or 'committer,author'\";\n+\t\t}\n+\t\tnext;\n+\t} elsif ($arg =~ /^--time-zone=/) {\n+\t\t# extra option\n+\t\t$arg =~ s/^--time-zone=//;\n+\t\t$ENV{TZ} = $arg;\n+\t\tnext;\n+\t} elsif ($arg eq \"--date-order\" || $arg eq \"--topo-order\") {\n+\t\t$dateopt = \"%ct\" unless $usecad;\n+\t} elsif ($arg eq \"--author-date-order\") {\n+\t\t$dateopt = \"%at\";\n+\t} elsif ($arg =~ /^--(pretty|pretty=.*|format=.*|notes|show-notes|show-notes=.*|standard-notes)$/) {\n+\t\tdodie \"formatting/notes option not allowed: $arg\";\n+\t} elsif ($arg eq \"--no-decorate\" || $arg eq \"--decorate=no\") {\n+\t\t$setusedecorate = 1;\n+\t\t$usedecorate = undef;\n+\t} elsif ($arg eq \"--decorate=auto\") {\n+\t\t$setusedecorate = 1;\n+\t\t$usedecorate = -t STDOUT ? 1 : undef;\n+\t} elsif ($arg eq \"--decorate\" || $arg =~ /^--decorate=/) {\n+\t\t$setusedecorate = 1;\n+\t\t$usedecorate = 1;\n+\t} elsif ($arg eq \"--color\" || $arg eq \"--color=always\") {\n+\t\t$setusecolor = 1;\n+\t\t$usecolor = 1;\n+\t} elsif ($arg eq \"--no-color\" || $arg eq \"--color=never\") {\n+\t\t$setusecolor = 1;\n+\t\t$usecolor = undef;\n+\t} elsif ($arg eq \"--color=auto\") {\n+\t\t$setusecolor = 1;\n+\t\t$usecolor = -t STDOUT ? 1 : undef;\n+\t} elsif ($arg eq \"-g\" || $arg eq \"--walk-reflogs\") {\n+\t\t$usereflog = 1;\n+\t} elsif ($arg eq \"--boundary\") {\n+\t\t$useboundary = 1;\n+\t\t$usemark = 1;\n+\t} elsif ($arg eq \"--cherry-mark\" || $arg eq \"--cherry\") {\n+\t\t$usecherry = 1;\n+\t\t$usemark = 1;\n+\t} elsif ($arg eq \"--left-right\") {\n+\t\t$useleftright = 1;\n+\t\t$usemark = 1;\n+\t} elsif ($arg eq \"--graph\") {\n+\t\t$usegraph = 1;\n+\t} elsif ($arg =~ /^(--grep|--grep-reflog|-S|-G)$/) {\n+\t\t$nextisgrep = 1;\n+\t} elsif ($arg eq \"--\") {\n+\t\t$sawdashdash = 1;\n+\t}\n+\tpush(@args, $arg);\n+\t$lastwasgrep = $nextisgrep;\n+}\n+$iw = defined($ivar2) ? 2 : 3 unless defined($iw);\n+$iw = \"\" if !$iw;\n+$iw2 = $iw if defined($ivar2);\n+my ($mark, $fixmark) = (\"\");\n+$mark = \"%m \" unless $usegraph || !$usemark;\n+if ($mark && !$useleftright) {\n+\t$fixmark = \" \";\n+\t$fixmark = \"+\" if $usecherry;\n+}\n+\n+my $color = \"never\";\n+my ($hashcolor, $datecolor, $timecolor, $initialscolor, $autocolor) = (\"\", \"\", \"\", \"\", \"\");\n+$usecolor = 1 if !$setusecolor && system(\"git\", \"config\", \"--get-colorbool\", \"color.diff\") == 0;\n+if ($usecolor) {\n+\t$color = \"always\";\n+\t$autocolor = \"%C(auto)\";\n+\t$hashcolor= qx(git config --get-color color.diff.commit \"yellow\");\n+\t$datecolor= qx(git config --get-color color.log-times.date \"bold blue\");\n+\t$timecolor= qx(git config --get-color color.log-times.time \"green\") if $timeformat;\n+\t$initialscolor = qx(git config --get-color color.log-times.initials \"red\") if $iw;\n+\t$resetcolor = qx(git config --get-color \"\" \"reset\");\n+}\n+my $decopt = \"\";\n+$decopt = \"$autocolor%d\" if use_decorate;\n+my $pager = qx(git var GIT_PAGER);\n+defined($pager) and chomp $pager;\n+$ENV{LESS} = \"-FRX\" unless exists $ENV{LESS};\n+$ENV{LV} = \"-c\" unless exists $ENV{LV};\n+\n+my ($lastdate, $lastprefix, $lastplainprefix) = (\"\");\n+my $msgopt = \"%s\";\n+$msgopt = \"%gd: $reflogsubj\" if $usereflog;\n+my $lastwasroot = 1;\n+open(LOG, '-|', \"git\", \"log\", \"--color=$color\",\n+\t\"--format=tformat:$mark%x1fCOMMIT %H %h $dateopt%x1f%cn%x1f%an%x1f%P%x1f$decopt $msgopt%x1f\",\n+\t@args) or exit(1);\n+if (defined($pager) && $pager ne \"cat\") {\n+\topen OUT, \"|$pager\" or dodie \"could not run pager \\\"$pager\\\": $!\\n\";\n+} else {\n+\topen OUT, '>&STDOUT' or die \"could not dupe STDOUT: $!\";\n+}\n+select((select(OUT),$|=1)[0]);\n+my $delblank;\n+my @lastparents = ();\n+my $lastwascommit;\n+my ($prefix, $data, $parentlist, $subject);\n+while (my $logline = <LOG>) {\n+\t($prefix, $data, $committer, $author, $parentlist, $subject) = split(/\\x1f/, $logline, -1);\n+\t$subject =~ s/ // if $subject;\n+\tmy ($flag, $fullhash, $hash, $timestamp) = split(\" \", $data, 4) if defined($data);\n+\tif (!defined($flag) || $flag ne \"COMMIT\") {\n+\t\tchomp $prefix;\n+\t\t$delblank = 0, next if $delblank && !$usegraph && $prefix =~ /^\\s*$/;\n+\t\t$delblank = 0, next if $delblank && $usegraph && !get_blank_graph_indent($prefix);\n+\t\tprint OUT \"$prefix\\n\";\n+\t\t$lastprefix = $prefix;\n+\t\t$lastplainprefix = undef;\n+\t\t@lastparents = ();\n+\t\t$lastwascommit = undef;\n+\t\tnext;\n+\t}\n+\tmy $isroot = !$parentlist;\n+\tmy @parents = split(' ', $parentlist) if $usegraph;\n+\tmy $initials = $iw ? get_initials($$ivar) : \"\";\n+\tmy $initials2 = $iw2 ? get_initials($$ivar2) : \"\";\n+\tmy ($newdate, $newday, $newtime) = split(\" \", strftime(\"%Y-%m-%d %a $timeformat\", localtime($timestamp)));\n+\t$newdate .= \" \" . $newday if $usewkday;\n+\tmy $mightneedbreak = $lastwascommit && !$lastwasroot && $usegraph && !grep($_ eq $fullhash, @lastparents);\n+\tif ($lastdate ne $newdate || $mightneedbreak) {\n+\t\tmy $indent = \"\";\n+\t\tif (!$lastdate || $mark) {\n+\t\t\t$indent = get_first_indent($prefix);\n+\t\t\t$lastprefix = $prefix;\n+\t\t\t$lastplainprefix = undef;\n+\t\t} elsif ($prefix ne \"\") {\n+\t\t\tmy $newplainprefix = get_nocolor_indent($prefix);\n+\t\t\tdefined($lastplainprefix) or $lastplainprefix = get_nocolor_indent($lastprefix);\n+\t\t\t$nobar = undef;\n+\t\t\t$barcolor = undef;\n+\t\t\tif ($newplainprefix =~ /^(.*?[-=^<>*+o])/) {{\n+\t\t\t\tmy $marklen = length($1);\n+\t\t\t\tmy $difflen = length($lastplainprefix) - length($1);\n+\t\t\t\t$nobar = 1;\n+\t\t\t\tif ($difflen >= 0) {\n+\t\t\t\t\tmy $lastmark = substr($lastplainprefix, $marklen-1, 1);\n+\t\t\t\t\t$lastmark =~ /[-=^<>*+o]/ and $nobar = $lastwasroot || $mightneedbreak, last;\n+\t\t\t\t\t$lastmark eq \"|\" && $lastdate ne $newdate and\n+\t\t\t\t\t\t$nobar = 0,\n+\t\t\t\t\t\t$barcolor = get_bar_color($lastprefix, $marklen - 1),\n+\t\t\t\t\t\tlast;\n+\t\t\t\t}\n+\t\t\t\tif ($lastdate eq $newdate) {\n+\t\t\t\t\t$lastprefix = $prefix;\n+\t\t\t\t\t$lastplainprefix = $newplainprefix;\n+\t\t\t\t\tgoto NOBREAKNEEDED;\n+\t\t\t\t}\n+\t\t\t\t$difflen >= -1 or last;\n+\t\t\t\tsubstr($lastplainprefix, $marklen-2, 1) eq \"\\\\\" and\n+\t\t\t\t\t$nobar = 0,\n+\t\t\t\t\t$barcolor = get_bar_color($lastprefix, $marklen - 2),\n+\t\t\t\t\tlast;\n+\t\t\t\t$difflen >= 1 &&\n+\t\t\t\tsubstr($lastplainprefix, $marklen, 1) eq \"/\" and\n+\t\t\t\t\t$nobar = 0,\n+\t\t\t\t\t$barcolor = get_bar_color($lastprefix, $marklen);\n+\t\t\t}}\n+\t\t\t$indent = get_indent($prefix);\n+\t\t\t$lastprefix = $prefix;\n+\t\t\t$prefix = get_prefix($prefix);\n+\t\t\t$lastplainprefix = $newplainprefix;\n+\t\t}\n+\t\tif ($lastdate ne $newdate) {\n+\t\t\tprintf OUT \"%s%s=== %s ===%s\\n\", $indent,\n+\t\t\t\t$datecolor, $newdate, $resetcolor;\n+\t\t\t$lastdate = $newdate;\n+\t\t} else {\n+\t\t\tprintf OUT \"%s%s %s%s%-${iw}s%s%-${iw2}s %s\\n\", $indent,\n+\t\t\t\t' ' x length($hash), ' ' x length($newtime),\n+\t\t\t\t($iw ? \" \" : \"\"), \"\", ($iw2 ? \" \" : \"\"), \"\",\n+\t\t\t\t\"..........\";\n+\t\t}\n+\t} else {\n+\t\t$lastprefix = $prefix;\n+\t\t$lastplainprefix = undef;\n+\t}\n+NOBREAKNEEDED:\n+\t$lastwasroot = $isroot;\n+\t@lastparents = @parents;\n+\t$lastwascommit = 1;\n+\tmy $rootflag = \" \";\n+\tif ($isroot) {\n+\t\t$rootflag = \"_\";\n+\t\t$prefix = substr($prefix, 0, length($prefix) - 1) . \"_\"\n+\t\t\tif length($prefix);\n+\t\tif ($prefix =~ /^(.*?[-=^<>*+o])(.+)$/) {\n+\t\t\tmy ($initial, $trail) = ($1, $2);\n+\t\t\t$trail =~ tr/ /_/;\n+\t\t\t$prefix = $initial . $trail;\n+\t\t}\n+\t}\n+\tif ($fixmark) {\n+\t\t$prefix = $fixmark . substr($prefix, 1)\n+\t\t\tif $prefix =~ /^[<>]/;\n+\t}\n+\tprintf OUT \"%s%s%s%s%s%-${iw}s%s%-${iw2}s%s%s\\n\", $prefix,\n+\t\t\"$hashcolor$hash$resetcolor\",\n+\t\t$rootflag, ($timeformat ? \"$timecolor$newtime$resetcolor \" : \"\"),\n+\t\t$initialscolor, $initials, ($iw2 ? \"/\" : \"\"), $initials2,\n+\t\t($iw ? \"$resetcolor \" : \"\"), $subject;\n+\t$delblank = 1;\n+}\n+close LOG;\n+close OUT;\n---\n"},{"id":"302864","messageId":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","threadId":"44186","inReplyTo":"git-log-times@mackyle-at-gmail-com","subject":"Re: [PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T08:33:15Z","receivedAt":"2016-09-29T08:33:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 28, 2016 at 10:34:51PM -0700, Kyle J. McKay wrote:\n\n> git log-times --graph --date-order --decorate --no-merges -n 5 v2.5.3\n> \n>     === 2015-09-17 ===\n>   * ee6ad5f4 12:16 jch (tag: v2.5.3) Git 2.5.3\n>     === 2015-09-09 ===\n>   * b9d66899 14:22 js  am --skip/--abort: merge HEAD/ORIG_HEAD tree into index\n>   |   === 2015-09-04 ===\n>   | * 27ea6f85 10:46 jch (tag: v2.5.2) Git 2.5.2\n>   * 74b67638 10:36 jch (tag: v2.4.9) Git 2.4.9\n>                        ..........\n>   * ecad27cf 10:32 jch (tag: v2.3.9) Git 2.3.9\n\nI was surprised to see this as a separate script, but it is true that we\ncannot quite pull it off with --format. I think we are very close,\nthough.  With the patches below I think you can do:\n\n  git log \\\n    --commit-header='%C(auto,bold blue)== %as ==%C(auto,reset)'\n    --format='%C(auto)%h %C(auto,green)%ad %C(auto,red)%aS/%cS%C(auto)%d%C(auto,reset) %s' \\\n    --graph --no-merges --author-date-order --date=format:%H:%M\n\nand get the same (or very similar) output.\n\n  [1/5]: pretty: allow formatting DATE_SHORT\n  [2/5]: pretty: allow formatting names as initials\n  [3/5]: graph: fix extra spaces in graph_padding_line\n  [4/5]: graph: helper functions for printing commit header\n  [5/5]: log: add --commit-header option\n\nEach of those commits[1] needs some minor polish, and as I'm not really\nthat interested in fancy log output myself, I don't plan on working on\nthem further. I was mostly curious just how close we were. But if you'd\nlike to pursue it, feel free to use them as a starting point.\n\n-Peff\n\n[1] Actually, I think patch 3 is a legitimate bug fix on its own but I\n    do not think there is any way to actually trigger it in practice\n    without the rest of this series.\n"},{"id":"302865","messageId":"20160929083342.ozo2tef45hu4ox7g@sigill.intra.peff.net","threadId":"44186","inReplyTo":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","subject":"[PATCH 1/5] pretty: allow formatting DATE_SHORT","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T08:33:42Z","receivedAt":"2016-09-29T08:33:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"There's no way to do this short of \"%ad\" and --date=short,\nbut that limits you to having a single date format in the\noutput.\n\nThis would possibly be better done with something more like\n\"%ad(short)\".\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n pretty.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/pretty.c b/pretty.c\nindex 493edb0..c532c17 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -727,6 +727,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 's':\n+\t\tstrbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n+\t\treturn placeholder_len;\n \t}\n \n skip:\n-- \n2.10.0.566.g5365f87\n\n"},{"id":"302866","messageId":"20160929083750.ohjl5jdtgso7okan@sigill.intra.peff.net","threadId":"44186","inReplyTo":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","subject":"[PATCH 3/5] graph: fix extra spaces in graph_padding_line","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T08:37:51Z","receivedAt":"2016-09-29T08:38:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The graph_padding_line() function outputs a series of \"|\"\ncolumns, and then pads with spaces to graph->width by\ncalling graph_pad_horizontally(). However, we tell the\nlatter that we wrote graph->num_columns characters, which is\nnot true; we also needed spaces between the columns. Let's\nkeep a count of how many characters we've written, which is\nwhat all the other callers of graph_pad_horizontally() do.\n\nWithout this, any output that is written at the end of a\npadding line will be bumped out by at least an extra\ngraph->num_columns spaces. Presumably nobody ever noticed\nthe bug because there's no code path that actually writes to\nthe end of a padding line.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n graph.c | 16 ++++++++++++----\n 1 file changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/graph.c b/graph.c\nindex 06f1139..d4e8519 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -1175,6 +1175,7 @@ int graph_next_line(struct git_graph *graph, struct strbuf *sb)\n static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tint i;\n+\tint chars_written = 0;\n \n \tif (graph->state != GRAPH_COMMIT) {\n \t\tgraph_next_line(graph, sb);\n@@ -1190,14 +1191,21 @@ static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)\n \t */\n \tfor (i = 0; i < graph->num_columns; i++) {\n \t\tstruct column *col = &graph->columns[i];\n+\n \t\tstrbuf_write_column(sb, col, '|');\n-\t\tif (col->commit == graph->commit && graph->num_parents > 2)\n-\t\t\tstrbuf_addchars(sb, ' ', (graph->num_parents - 2) * 2);\n-\t\telse\n+\t\tchars_written++;\n+\n+\t\tif (col->commit == graph->commit && graph->num_parents > 2) {\n+\t\t\tint len = (graph->num_parents - 2) * 2;\n+\t\t\tstrbuf_addchars(sb, ' ', len);\n+\t\t\tchars_written += len;\n+\t\t} else {\n \t\t\tstrbuf_addch(sb, ' ');\n+\t\t\tchars_written++;\n+\t\t}\n \t}\n \n-\tgraph_pad_horizontally(graph, sb, graph->num_columns);\n+\tgraph_pad_horizontally(graph, sb, chars_written);\n \n \t/*\n \t * Update graph->prev_state since we have output a padding line\n-- \n2.10.0.566.g5365f87\n\n"},{"id":"302867","messageId":"20160929083815.xgbdv62srna3cbg5@sigill.intra.peff.net","threadId":"44186","inReplyTo":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","subject":"[PATCH 4/5] graph: helper functions for printing commit header","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T08:38:15Z","receivedAt":"2016-09-29T08:38:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The idea here is to make it possible to print something\nright _before_ a commit in the graph. It's a bit ugly, but\nit seems to work.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n graph.c | 14 +++++++++++++-\n graph.h |  6 ++++++\n 2 files changed, 19 insertions(+), 1 deletion(-)\n\ndiff --git a/graph.c b/graph.c\nindex d4e8519..56daa70 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -1218,7 +1218,7 @@ int graph_is_commit_finished(struct git_graph const *graph)\n \treturn (graph->state == GRAPH_PADDING);\n }\n \n-void graph_show_commit(struct git_graph *graph)\n+static void graph_show_commit_1(struct git_graph *graph, int only_pre)\n {\n \tstruct strbuf msgbuf = STRBUF_INIT;\n \tint shown_commit_line = 0;\n@@ -1239,6 +1239,8 @@ void graph_show_commit(struct git_graph *graph)\n \t}\n \n \twhile (!shown_commit_line && !graph_is_commit_finished(graph)) {\n+\t\tif (only_pre && graph->state == GRAPH_COMMIT)\n+\t\t\tbreak;\n \t\tshown_commit_line = graph_next_line(graph, &msgbuf);\n \t\tfwrite(msgbuf.buf, sizeof(char), msgbuf.len,\n \t\t\tgraph->revs->diffopt.file);\n@@ -1252,6 +1254,16 @@ void graph_show_commit(struct git_graph *graph)\n \tstrbuf_release(&msgbuf);\n }\n \n+void graph_show_precommit(struct git_graph *graph)\n+{\n+\tgraph_show_commit_1(graph, 1);\n+}\n+\n+void graph_show_commit(struct git_graph *graph)\n+{\n+\tgraph_show_commit_1(graph, 0);\n+}\n+\n void graph_show_oneline(struct git_graph *graph)\n {\n \tstruct strbuf msgbuf = STRBUF_INIT;\ndiff --git a/graph.h b/graph.h\nindex af62339..e13e97f 100644\n--- a/graph.h\n+++ b/graph.h\n@@ -97,6 +97,12 @@ int graph_width(struct git_graph *graph);\n  */\n void graph_show_commit(struct git_graph *graph);\n \n+/*\n+ * Same as graph_show_commit, but stop just _before_ printing\n+ * the actual commit line.\n+ */\n+void graph_show_precommit(struct git_graph *graph);\n+\n /*\n  * If the graph is non-NULL, print one line of the history graph to stdout.\n  * Does not print a terminating newline on the last line.\n-- \n2.10.0.566.g5365f87\n\n"},{"id":"302868","messageId":"20160929083654.nofgkn6kwb7bavzk@sigill.intra.peff.net","threadId":"44186","inReplyTo":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","subject":"[PATCH 2/5] pretty: allow formatting names as initials","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T08:36:54Z","receivedAt":"2016-09-29T08:38:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Initials are shorter and often unique enough in a\nper-project setting, so they can be used to give a more\ninformative version of --oneline.\n\nThe 'S' in the placeholder is for \"short\" (and 's' is\nalready taken by DATE_SHORT), but obviously that's pretty\narcane.\n\nPossibly there should be more customization of initials,\nasking for only 2-letter initials, etc.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nWhen I first tested it with \"git log --format=%aS\" I had to wonder \"who\nthe heck is ntnd?\". So using only the first-and-last would match the git\nproject's practice better, at least.\n\n pretty.c | 21 +++++++++++++++++++++\n 1 file changed, 21 insertions(+)\n\ndiff --git a/pretty.c b/pretty.c\nindex c532c17..de62405 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -674,6 +674,23 @@ static int mailmap_name(const char **email, size_t *email_len,\n \treturn mail_map->nr && map_user(mail_map, email, email_len, name, name_len);\n }\n \n+static void format_initials(struct strbuf *out, const char *name, size_t len)\n+{\n+\tint initial = 1;\n+\tsize_t i;\n+\n+\tfor (i = 0; i < len; i++) {\n+\t\tchar c = name[i];\n+\t\tif (isspace(c)) {\n+\t\t\tinitial = 1;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (initial && isalpha(c))\n+\t\t\tstrbuf_addch(out, tolower(c));\n+\t\tinitial = 0;\n+\t}\n+}\n+\n static size_t format_person_part(struct strbuf *sb, char part,\n \t\t\t\t const char *msg, int len,\n \t\t\t\t const struct date_mode *dmode)\n@@ -702,6 +719,10 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \t\tstrbuf_add(sb, mail, maillen);\n \t\treturn placeholder_len;\n \t}\n+\tif (part == 'S') {\n+\t\tformat_initials(sb, name, namelen);\n+\t\treturn placeholder_len;\n+\t}\n \n \tif (!s.date_begin)\n \t\tgoto skip;\n-- \n2.10.0.566.g5365f87\n\n"},{"id":"302869","messageId":"20160929083851.kx6itvrh4n2rttrx@sigill.intra.peff.net","threadId":"44186","inReplyTo":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","subject":"[PATCH 5/5] log: add --commit-header option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T08:38:51Z","receivedAt":"2016-09-29T08:39:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This lets you stick a header right before a commit, but\nsuppresses headers that are duplicates. This means you can\ndo something like:\n\n  git log --graph --author-date-order --commit-header='== %as =='\n\nto get a marker in the graph whenever the day changes.\n\nThis probably needs some refactoring around the setup of the\npretty-print context.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n log-tree.c | 31 +++++++++++++++++++++++++++++++\n revision.c |  4 ++++\n revision.h |  3 +++\n 3 files changed, 38 insertions(+)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 8c24157..76cef51 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -536,6 +536,28 @@ static void show_mergetag(struct rev_info *opt, struct commit *commit)\n \tfor_each_mergetag(show_one_mergetag, commit, opt);\n }\n \n+static void show_commit_header(struct rev_info *opt,\n+\t\t\t       struct pretty_print_context *pp,\n+\t\t\t       struct commit *commit)\n+{\n+\tstruct strbuf out = STRBUF_INIT;\n+\n+\tformat_commit_message(commit, opt->commit_header, &out, pp);\n+\tstrbuf_complete_line(&out);\n+\n+\tif (!strbuf_cmp(&out, &opt->last_commit_header)) {\n+\t\tstrbuf_release(&out);\n+\t\treturn;\n+\t}\n+\n+\tgraph_show_precommit(opt->graph);\n+\tgraph_show_padding(opt->graph);\n+\tfwrite(out.buf, 1, out.len, opt->diffopt.file);\n+\n+\tstrbuf_swap(&out, &opt->last_commit_header);\n+\tstrbuf_release(&out);\n+}\n+\n void show_log(struct rev_info *opt)\n {\n \tstruct strbuf msgbuf = STRBUF_INIT;\n@@ -591,6 +613,15 @@ void show_log(struct rev_info *opt)\n \t}\n \topt->shown_one = 1;\n \n+\tif (opt->commit_header) {\n+\t\t/*\n+\t\t * XXX probably the initialization of the pretty ctx from \"opt\"\n+\t\t * below should happen sooner so we can use it.\n+\t\t */\n+\t\tctx.color = opt->diffopt.use_color;\n+\t\tshow_commit_header(opt, &ctx, commit);\n+\t}\n+\n \t/*\n \t * If the history graph was requested,\n \t * print the graph, up to this commit's line\ndiff --git a/revision.c b/revision.c\nindex 969b3d1..229ff86 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1361,6 +1361,8 @@ void init_revisions(struct rev_info *revs, const char *prefix)\n \t}\n \n \trevs->notes_opt.use_default_notes = -1;\n+\n+\tstrbuf_init(&revs->last_commit_header, 0);\n }\n \n static void add_pending_commit_list(struct rev_info *revs,\n@@ -1844,6 +1846,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\trevs->verbose_header = 1;\n \t\trevs->pretty_given = 1;\n \t\tget_commit_format(arg+9, revs);\n+\t} else if (skip_prefix(arg, \"--commit-header=\", &arg)) {\n+\t\trevs->commit_header = arg;\n \t} else if (!strcmp(arg, \"--expand-tabs\")) {\n \t\trevs->expand_tabs_in_log = 8;\n \t} else if (!strcmp(arg, \"--no-expand-tabs\")) {\ndiff --git a/revision.h b/revision.h\nindex 9fac1a6..39ec092 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -170,6 +170,9 @@ struct rev_info {\n \tint\t\tshow_log_size;\n \tstruct string_list *mailmap;\n \n+\tconst char *commit_header;\n+\tstruct strbuf last_commit_header;\n+\n \t/* Filter by commit log message */\n \tstruct grep_opt\tgrep_filter;\n \t/* Negate the match of grep_filter */\n-- \n2.10.0.566.g5365f87\n"},{"id":"302878","messageId":"82EE6519-E58F-4382-87A5-55D9D1BBDCA9@gmail.com","threadId":"44186","inReplyTo":"20160929083315.vwb3aurwbyjwlkjn@sigill.intra.peff.net","subject":"Re: [PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Kyle J. McKay","fromEmail":"mackyle@gmail.com","sentAt":"2016-09-29T11:00:06Z","receivedAt":"2016-09-29T11:00:15Z","isPatch":true,"sender":{"key":"mackyle@gmail.com","avatar":"https://avatars.githubusercontent.com/u/813346?v=4"},"body":"On Sep 29, 2016, at 01:33, Jeff King wrote:\n\n> On Wed, Sep 28, 2016 at 10:34:51PM -0700, Kyle J. McKay wrote:\n>\n>> git log-times --graph --date-order --decorate --no-merges -n 5 v2.5.3\n>>\n>>    === 2015-09-17 ===\n>>  * ee6ad5f4 12:16 jch (tag: v2.5.3) Git 2.5.3\n>>    === 2015-09-09 ===\n>>  * b9d66899 14:22 js  am --skip/--abort: merge HEAD/ORIG_HEAD tree  \n>> into index\n>>  |   === 2015-09-04 ===\n>>  | * 27ea6f85 10:46 jch (tag: v2.5.2) Git 2.5.2\n>>  * 74b67638 10:36 jch (tag: v2.4.9) Git 2.4.9\n>>                       ..........\n>>  * ecad27cf 10:32 jch (tag: v2.3.9) Git 2.3.9\n>\n> I was surprised to see this as a separate script, but it is true  \n> that we\n> cannot quite pull it off with --format. I think we are very close,\n> though.  With the patches below I think you can do:\n>\n>  git log \\\n>    --commit-header='%C(auto,bold blue)== %as ==%C(auto,reset)'\n>    --format='%C(auto)%h %C(auto,green)%ad %C(auto,red)%aS/%cS%C(auto) \n> %d%C(auto,reset) %s' \\\n>    --graph --no-merges --author-date-order --date=format:%H:%M\n>\n> and get the same (or very similar) output.\n>\n>  [1/5]: pretty: allow formatting DATE_SHORT\n>  [2/5]: pretty: allow formatting names as initials\n>  [3/5]: graph: fix extra spaces in graph_padding_line\n>  [4/5]: graph: helper functions for printing commit header\n>  [5/5]: log: add --commit-header option\n>\n> Each of those commits[1] needs some minor polish, and as I'm not  \n> really\n> that interested in fancy log output myself, I don't plan on working on\n> them further. I was mostly curious just how close we were. But if  \n> you'd\n> like to pursue it, feel free to use them as a starting point.\n\nThose patches are missing some of the features like showing root  \ncommits, handling two letter initials, showing the weekday, inserting  \na break where needed to avoid parent-child confusion in graph output  \nand properly handling Duy's initials. :)\n\nI suppose if all the objects that output a date took a '(' <strftime>  \n')' option that would get you part of the way -- it could replace  \nDATE_SHORT with DATE_STRFTIME.\n\nAlso the above example doesn't handle marks properly in graph mode.   \nYes, you can add the \"%m\" format option but it does something odd and  \nthe script fixes it up.\n\nOn the other hand, git-log-times started out as a script for something  \nelse (a shell script actually) and just got embellished further and  \nturned into a perl script for speed.\n\nYour patches are a good first start though but reading the --graph  \ncode gives me headaches and I figured it would be like going down a  \nrabbit hole to make the code support everything the script does.\n\nThe script also has one big advantage.  It works with the version of  \nGit everybody already has installed.  :)\n\nAnd nobody is ever going to want to type several lines of arcane  \nformatting instructions to get the output.  ;_)\n\nIt would need a new option, perhaps --oneline-extended or something.\n\nThe patches are a good start but that doesn't help anyone using Git  \ntoday which is why git-log-times is submitted as a contrib script --  \nmuch like the way diff-highlight is still a contrib script and not  \nsupported directly by Git either.\n\n--Kyle\n\n"},{"id":"302882","messageId":"20160929125238.hifkxe7cmyebg64u@sigill.intra.peff.net","threadId":"44186","inReplyTo":"82EE6519-E58F-4382-87A5-55D9D1BBDCA9@gmail.com","subject":"Re: [PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T12:52:38Z","receivedAt":"2016-09-29T12:52:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 29, 2016 at 04:00:06AM -0700, Kyle J. McKay wrote:\n\n> > Each of those commits[1] needs some minor polish, and as I'm not really\n> > that interested in fancy log output myself, I don't plan on working on\n> > them further. I was mostly curious just how close we were. But if you'd\n> > like to pursue it, feel free to use them as a starting point.\n> \n> Those patches are missing some of the features like showing root commits,\n> handling two letter initials, showing the weekday, inserting a break where\n> needed to avoid parent-child confusion in graph output and properly handling\n> Duy's initials. :)\n\nI'm not too surprised. I literally looked at the first screenshot from\nyour output and thought \"surely git can do that with some minor tweaks\".\nNor am I surprised that there are cases where the output is funny (99%\nof the time I spent on it was tracking down that graph-padding bug).\n\nI have no problem taking this in contrib or whatever, until a point when\nGit is capable of doing the same thing itself. I just hoped to trick you\ninto working on Git. :)\n\n-Peff\n"},{"id":"302897","messageId":"xmqq37kihatp.fsf@gitster.mtv.corp.google.com","threadId":"44186","inReplyTo":"20160929083654.nofgkn6kwb7bavzk@sigill.intra.peff.net","subject":"Re: [PATCH 2/5] pretty: allow formatting names as initials","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T17:31:30Z","receivedAt":"2016-09-29T17:31:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Initials are shorter and often unique enough in a\n> per-project setting, so they can be used to give a more\n> informative version of --oneline.\n>\n> The 'S' in the placeholder is for \"short\" (and 's' is\n> already taken by DATE_SHORT), but obviously that's pretty\n> arcane.\n>\n> Possibly there should be more customization of initials,\n> asking for only 2-letter initials, etc.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> When I first tested it with \"git log --format=%aS\" I had to wonder \"who\n> the heck is ntnd?\". So using only the first-and-last would match the git\n> project's practice better, at least.\n\nAnd there is also \"isalpha() good enough?\" question.\n\nI think we have a few Chinese and Hangul as well as Cyrillic names\nin our history, some of them having outside-ascii first letters.\nOne of the more prolific contributor's initial is ÆAB ;-)\n\n>  pretty.c | 21 +++++++++++++++++++++\n>  1 file changed, 21 insertions(+)\n>\n> diff --git a/pretty.c b/pretty.c\n> index c532c17..de62405 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -674,6 +674,23 @@ static int mailmap_name(const char **email, size_t *email_len,\n>  \treturn mail_map->nr && map_user(mail_map, email, email_len, name, name_len);\n>  }\n>  \n> +static void format_initials(struct strbuf *out, const char *name, size_t len)\n> +{\n> +\tint initial = 1;\n> +\tsize_t i;\n> +\n> +\tfor (i = 0; i < len; i++) {\n> +\t\tchar c = name[i];\n> +\t\tif (isspace(c)) {\n> +\t\t\tinitial = 1;\n> +\t\t\tcontinue;\n> +\t\t}\n> +\t\tif (initial && isalpha(c))\n> +\t\t\tstrbuf_addch(out, tolower(c));\n> +\t\tinitial = 0;\n> +\t}\n> +}\n> +\n>  static size_t format_person_part(struct strbuf *sb, char part,\n>  \t\t\t\t const char *msg, int len,\n>  \t\t\t\t const struct date_mode *dmode)\n> @@ -702,6 +719,10 @@ static size_t format_person_part(struct strbuf *sb, char part,\n>  \t\tstrbuf_add(sb, mail, maillen);\n>  \t\treturn placeholder_len;\n>  \t}\n> +\tif (part == 'S') {\n> +\t\tformat_initials(sb, name, namelen);\n> +\t\treturn placeholder_len;\n> +\t}\n>  \n>  \tif (!s.date_begin)\n>  \t\tgoto skip;\n"},{"id":"302898","messageId":"20160929173239.c62vv3gtdoz3r6ij@sigill.intra.peff.net","threadId":"44186","inReplyTo":"xmqq37kihatp.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/5] pretty: allow formatting names as initials","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T17:32:39Z","receivedAt":"2016-09-29T17:32:48Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 29, 2016 at 10:31:30AM -0700, Junio C Hamano wrote:\n\n> > When I first tested it with \"git log --format=%aS\" I had to wonder \"who\n> > the heck is ntnd?\". So using only the first-and-last would match the git\n> > project's practice better, at least.\n> \n> And there is also \"isalpha() good enough?\" question.\n> \n> I think we have a few Chinese and Hangul as well as Cyrillic names\n> in our history, some of them having outside-ascii first letters.\n> One of the more prolific contributor's initial is ÆAB ;-)\n\nHeh, true. In case it was not clear, these were mostly quick-and-dirty\npatches. I think the right test is probably '!isspace()\".\n\n-Peff\n"},{"id":"302899","messageId":"xmqqy42afvy1.fsf@gitster.mtv.corp.google.com","threadId":"44186","inReplyTo":"20160929125238.hifkxe7cmyebg64u@sigill.intra.peff.net","subject":"Re: [PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T17:38:14Z","receivedAt":"2016-09-29T17:38:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> Those patches are missing some of the features like showing root commits,\n>> handling two letter initials, showing the weekday, inserting a break where\n>> needed to avoid parent-child confusion in graph output and properly handling\n>> Duy's initials. :)\n>\n> I'm not too surprised. I literally looked at the first screenshot from\n> your output and thought \"surely git can do that with some minor tweaks\".\n> Nor am I surprised that there are cases where the output is funny (99%\n> of the time I spent on it was tracking down that graph-padding bug).\n>\n> I have no problem taking this in contrib or whatever, until a point when\n> Git is capable of doing the same thing itself. I just hoped to trick you\n> into working on Git. :)\n\nI thought we stopped adding random things to contrib/, though.\n\nUnlike the earlier days of Git, if a custom command that uses Git is\nvery userful, it can live its own life and flourish within the much\nlarger Git userbase we have these days.\n"},{"id":"302901","messageId":"xmqqtwcyfvfz.fsf@gitster.mtv.corp.google.com","threadId":"44186","inReplyTo":"20160929083851.kx6itvrh4n2rttrx@sigill.intra.peff.net","subject":"Re: [PATCH 5/5] log: add --commit-header option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T17:49:04Z","receivedAt":"2016-09-29T17:49:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> This lets you stick a header right before a commit, but\n> suppresses headers that are duplicates. This means you can\n> do something like:\n>\n>   git log --graph --author-date-order --commit-header='== %as =='\n>\n> to get a marker in the graph whenever the day changes.\n\nThat's interesting.  So it is not really \"commit\" header, but a\nheader for groups of commits.  Credits for realizing the usefulness\nof such grouping may go to Kyle, but the implementation is also\nbrilliant ;-).\n\n> This probably needs some refactoring around the setup of the\n> pretty-print context.\n\n"},{"id":"302909","messageId":"20160929183006.exyaikr4ijiq5tp3@sigill.intra.peff.net","threadId":"44186","inReplyTo":"xmqqy42afvy1.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T18:30:06Z","receivedAt":"2016-09-29T18:30:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 29, 2016 at 10:38:14AM -0700, Junio C Hamano wrote:\n\n> > I have no problem taking this in contrib or whatever, until a point when\n> > Git is capable of doing the same thing itself. I just hoped to trick you\n> > into working on Git. :)\n> \n> I thought we stopped adding random things to contrib/, though.\n> \n> Unlike the earlier days of Git, if a custom command that uses Git is\n> very userful, it can live its own life and flourish within the much\n> larger Git userbase we have these days.\n\nI dunno. I said \"contrib or whatever\" to duck that question. :)\n\nI do not have a strong opinion either way. In some ways this script is\nsimilar to diff-highlight, which is in contrib. Perhaps that is only\nbecause diff-highlight is grandfathered. But I also think it somewhat\nmakes sense, because in an ideal world diff-highlight gets thrown away\nin favor of git's internal diff routines learning to do the same thing.\nAnd in theory this script is in the same position.\n\nBut I also buy the argument that contrib/ is simply a hassle. This\nscript can live in its own repository somewhere, and handle\nannouncements and patches on the list. For that matter, so could\ndiff-highlight, and I don't mind ripping it out of contrib if that's the\nconsensus.  My only real objection is that doing so is more work than\nleaving it as-is, and I'm lazy.\n\n-Peff\n"},{"id":"302910","messageId":"20160929183127.4ptf2dqdeo67avte@sigill.intra.peff.net","threadId":"44186","inReplyTo":"xmqqtwcyfvfz.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 5/5] log: add --commit-header option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-29T18:31:27Z","receivedAt":"2016-09-29T18:31:34Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 29, 2016 at 10:49:04AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > This lets you stick a header right before a commit, but\n> > suppresses headers that are duplicates. This means you can\n> > do something like:\n> >\n> >   git log --graph --author-date-order --commit-header='== %as =='\n> >\n> > to get a marker in the graph whenever the day changes.\n> \n> That's interesting.  So it is not really \"commit\" header, but a\n> header for groups of commits.  Credits for realizing the usefulness\n> of such grouping may go to Kyle, but the implementation is also\n> brilliant ;-).\n\nYeah, I really don't like the name \"--commit-header\" that much. I\ninitially thought to call it \"--graph-header\", but it is potentially\nuseful without a graph, too. Maybe \"--group-header\" or something.\nI dunno. I'd leave that to somebody who actually wanted to polish the\npatches up enough for submission. That might even be me someday, but not\ntoday. :)\n\n-Peff\n"},{"id":"302915","messageId":"xmqqeg42fslw.fsf@gitster.mtv.corp.google.com","threadId":"44186","inReplyTo":"20160929183006.exyaikr4ijiq5tp3@sigill.intra.peff.net","subject":"Re: [PATCH/RFC] git log --oneline alternative with dates, times and initials","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-29T18:50:19Z","receivedAt":"2016-09-29T18:50:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> But I also buy the argument that contrib/ is simply a hassle. This\n> script can live in its own repository somewhere, and handle\n> announcements and patches on the list.\n\nI think the output of this script is largely personal preference,\nwhich can be made to a project preference for a project enough of\nwhose participant so desires.\n\nFor example, I would not be surprised if this appeared next to\ncheckpatch.pl script in the kernel archive.  When a project that\nuses Git to store its sources finds a need to summarize its log in a\nstandardized way that is not produced natively by Git, such a\nproject may add this script to its scripts/ area, just like a\nproject that wants to have a standard way to help its contributors\nto avoid common style errors a lot more than our \"diff\" (which only\nhighlights whitespace errors) does may ship checkpatch.pl in it.\n\nSo in that sense, while I do not mean to say that the script itself\nmust become a standalone project that has only one script in it, I\ndo not think it belongs \"our\" contrib/, as we do not see a need to\nstandardize its output as the log summary standard we the Git\nproject uses on its own history.\n\nOn the other hand, your illustration of the needed bits to express\nthis particular output format used by Kyle's script, when polished,\ndoes fit in our codebase.  We are interested in making it possible\nfor projects and users to do more by using Git with its standard\ncustomization features.\n"},{"id":"302981","messageId":"CA+P7+xoxTpqn=jkuHYp5pKCCWfKLP5OKCTBYkcTVw_RhEw0KVw@mail.gmail.com","threadId":"44186","inReplyTo":"20160929083342.ozo2tef45hu4ox7g@sigill.intra.peff.net","subject":"Re: [PATCH 1/5] pretty: allow formatting DATE_SHORT","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-09-30T06:17:57Z","receivedAt":"2016-09-30T06:18:24Z","isPatch":true,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Thu, Sep 29, 2016 at 1:33 AM, Jeff King <peff@peff.net> wrote:\n> There's no way to do this short of \"%ad\" and --date=short,\n> but that limits you to having a single date format in the\n> output.\n>\n> This would possibly be better done with something more like\n> \"%ad(short)\".\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  pretty.c | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/pretty.c b/pretty.c\n> index 493edb0..c532c17 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -727,6 +727,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 's':\n> +               strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n> +               return placeholder_len;\n>         }\n>\n>  skip:\n> --\n> 2.10.0.566.g5365f87\n>\n\nNice. I use date=short in some of my aliases and switching to this is\nnicer. I assume this turns into \"%(as)\"?\n\nWhat about documenting this in  pretty-formats.txt?\n\nThanks,\nJake\n"},{"id":"302986","messageId":"20160930105639.15589-1-szeder@ira.uka.de","threadId":"44186","inReplyTo":"CA+P7+xoxTpqn=jkuHYp5pKCCWfKLP5OKCTBYkcTVw_RhEw0KVw@mail.gmail.com","subject":"Re: [PATCH 1/5] pretty: allow formatting DATE_SHORT","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2016-09-30T10:56:39Z","receivedAt":"2016-09-30T10:57:39Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"> On Thu, Sep 29, 2016 at 1:33 AM, Jeff King <peff@peff.net> wrote:\n> > There's no way to do this short of \"%ad\" and --date=short,\n> > but that limits you to having a single date format in the\n> > output.\n> >\n> > This would possibly be better done with something more like\n> > \"%ad(short)\".\n> >\n> > Signed-off-by: Jeff King <peff@peff.net>\n> > ---\n> >  pretty.c | 3 +++\n> >  1 file changed, 3 insertions(+)\n> >\n> > diff --git a/pretty.c b/pretty.c\n> > index 493edb0..c532c17 100644\n> > --- a/pretty.c\n> > +++ b/pretty.c\n> > @@ -727,6 +727,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 's':\n> > +               strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n> > +               return placeholder_len;\n> >         }\n> >\n> >  skip:\n> > --\n> > 2.10.0.566.g5365f87\n> >\n> \n> Nice. I use date=short in some of my aliases and switching to this is\n> nicer. I assume this turns into \"%(as)\"?\n> \n> What about documenting this in  pretty-formats.txt?\n\nHere you go :)\n\n  http://public-inbox.org/git/1444235305-8718-1-git-send-email-szeder@ira.uka.de/\n\n"},{"id":"303020","messageId":"CA+P7+xpWi_qgRTVmLf-bJq1mn7dW0Hf6544wHsOgFniDQyHo2Q@mail.gmail.com","threadId":"44186","inReplyTo":"20160930105639.15589-1-szeder@ira.uka.de","subject":"Re: [PATCH 1/5] pretty: allow formatting DATE_SHORT","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-09-30T22:04:54Z","receivedAt":"2016-09-30T22:08:25Z","isPatch":true,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Fri, Sep 30, 2016 at 3:56 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n>> On Thu, Sep 29, 2016 at 1:33 AM, Jeff King <peff@peff.net> wrote:\n>> > There's no way to do this short of \"%ad\" and --date=short,\n>> > but that limits you to having a single date format in the\n>> > output.\n>> >\n>> > This would possibly be better done with something more like\n>> > \"%ad(short)\".\n>> >\n>> > Signed-off-by: Jeff King <peff@peff.net>\n>> > ---\n>> >  pretty.c | 3 +++\n>> >  1 file changed, 3 insertions(+)\n>> >\n>> > diff --git a/pretty.c b/pretty.c\n>> > index 493edb0..c532c17 100644\n>> > --- a/pretty.c\n>> > +++ b/pretty.c\n>> > @@ -727,6 +727,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 's':\n>> > +               strbuf_addstr(sb, show_ident_date(&s, DATE_MODE(SHORT)));\n>> > +               return placeholder_len;\n>> >         }\n>> >\n>> >  skip:\n>> > --\n>> > 2.10.0.566.g5365f87\n>> >\n>>\n>> Nice. I use date=short in some of my aliases and switching to this is\n>> nicer. I assume this turns into \"%(as)\"?\n>>\n>> What about documenting this in  pretty-formats.txt?\n>\n> Here you go :)\n>\n>   http://public-inbox.org/git/1444235305-8718-1-git-send-email-szeder@ira.uka.de/\n>\n\nNice, thanks!\n\nRegards,\nJake\n"},{"id":"303042","messageId":"20161001091828.k4odmjv73haa5vyl@sigill.intra.peff.net","threadId":"44186","inReplyTo":"20160930105639.15589-1-szeder@ira.uka.de","subject":"Re: [PATCH 1/5] pretty: allow formatting DATE_SHORT","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-10-01T09:18:28Z","receivedAt":"2016-10-01T09:18:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 30, 2016 at 12:56:39PM +0200, SZEDER Gábor wrote:\n\n> > Nice. I use date=short in some of my aliases and switching to this is\n> > nicer. I assume this turns into \"%(as)\"?\n> > \n> > What about documenting this in  pretty-formats.txt?\n> \n> Here you go :)\n> \n>   http://public-inbox.org/git/1444235305-8718-1-git-send-email-szeder@ira.uka.de/\n\nThe review on that thread is basically \"do we want to add every\nabbreviation under the sun, or do we want to come up with a better\nplaceholder scheme?\". And that has come up several other times (e.g.,\nTed's recent %gt placeholder).\n\nI _do_ think that's the right way forward, but as nobody has been\npushing it that way, and these things come up from time to time, maybe\nwe should just accept it and add the ones people want in the interim.\nIt's not like it makes the situation significantly worse, or harder to\nmigrate to %(authordate:short).\n\n-Peff\n"}]}